sp_rename

  • Hi All,

    I need to use sp_rename - http://msdn.microsoft.com/en-us/library/ms188351.aspx

    I need to use it for tables in the following way:

    For an existing "table_name" table i create "table_name_new" table. I copy all the data from "table_name" to "table_name_new". Then i drop "table_name" and rename "table_name_new" to "table_name". Finally i create the FKs and indexes with same definitions as they were in "table_name".

    I know it could be problematic using sp_rename for some other objects like SPs, FNs ...

    Has anyone experienced any problems with renaming a table in this way. Please share.

    Can anyone confirm as save the usage of sp_rename, and/or suggest something additionally.

    Thanks

    IgorMi

    Igor Micev,My blog: www.igormicev.com

  • you should first check the dependencies for the particular object

    by sp_depends

    or by sys.dm_sql_referencing_entities ('OBJECT', 'OBJECT');

    then you can modify your object in a more appropriate way

Viewing 2 posts - 1 through 1 (of 1 total)

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