Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            string text = "CREATE PROCEDURE [dbo].[Testprocedure_2]\n"
                          + "        @BusinessID NVARCHAR(100)\n"
                          + " AS\n" + " BEGIN\n"
                          + "   SET NOCOUNT  ON;\n"
                          + "   SELECT dbo.tb_Rentals.*,\n"
                          + "          MinimalRentalID,\n"
                          + "          SEA.Name,\n"
                          + "          SEA.BeginDay,\n"
                          + "          SEA.EndDay,\n"
                          + "          dbo.tb_RentalTypes.Name AS TypeName\n"
                          + "   FROM   dbo.tb_Rentals,\n"
                          + "          dbo.tb_Seasons SEA,\n"
                          + "          dbo.tb_RentalTypes,\n"
                          + "          dbo.tb_RentalToSeason\n"
                          + "   WHERE  dbo.tb_Rentals.BusinessID_XXX = SEA.BusinessID \n"
                          + "          AND dbo.tb_Rentals.RentalTypeID = dbo.tb_RentalTypes.RentalTypeID\n"
                          + "          AND dbo.tb_RentalToSeason.RentalID = dbo.tb_Rentals.RentalID\n"
                          + "          AND dbo.tb_RentalToSeason.SeasonID = SEA.SeasonID\n"
                          + "          AND dbo.tb_Rentals.BusinessID = @BusinessID \n"
                          + "          AND @BusinessID IN (SELECT DISTINCT dbo.tb_Rentals.BusinessID_XXX\n"
                          + "                              FROM   dbo.tb_Rentals\n"
                          + "                              WHERE  dbo.tb_Rentals.BusinessID = @BusinessID)\n"
                          + " END";
            IDictionary <string, IList <string> > metaInfo = new Dictionary <string, IList <string> >();

            metaInfo["dbo.tb_Seasons".ToLower()] = new List <string>(new string[] { "MinimalRentalID".ToLower() });
            tableColumnRename ro = new tableColumnRename(EDbVendor.dbvmssql, text, metaInfo);
            int ret = ro.renameColumn("dbo.tb_Seasons.MinimalRentalID", "MinimalRentalID_xx");

            Console.WriteLine("Message: " + ro.msg);
            if (ret > 0)
            {
                Console.WriteLine("Result: ");
                Console.WriteLine(ro.ModifiedText);
            }
        }
Ejemplo n.º 2
0
 public metaDB(tableColumnRename outerInstance)
 {
     this.outerInstance = outerInstance;
 }