Renaming a Table..

  • Hi All

      I have requirement to rename a user tables, What are different options available ?

    right now i am using "sp_rename", Though db user created for application will have do_owner role also i won't be having any sp's or trigger on these tables. I feel its not good idea to go with sp_rename, also sp_rename throws a "caution" any idea how to disable it ?

     We have "Tablemanagement Service" in the application that does table alteration , adding indexes, constraints etc..now renaming table will be another part in this.  

       Any suggestion on this will be highly appreciated !!!!!

        

    Regards
    Shrikant Kulkarni

  • renaming a table is not recommended as this will cause some codes to break especially those that don't use SPs to address them

    but it's probably your requirement, just check for dependent objects, they must be redirected after the rename e.g. SPs, UDFs, triggers, replication setup, dts packages, jobs that reference to the table like archiving

     

    HTH

  • i agree with jen.

    but if you must you can put your table names old and new in an array and then probably use a cursor with your sp_rename


    Everything you can imagine is real.

  • I have the same problem as Shrikant. I need to rename my tables. I read through the help section in the SQL online book which doesnt offer any solution. Could anyone tell me the way to use the 'Database Designer' ??

  • My Dear Friend,

    pls use the following Query :--

     

    Sp_rename 'oldname','new name'

     

    ok!!

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply