Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Rename Table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-17 : 07:30:18
Luke Ward writes "Hi,

I need to rename a table, and was wondering how to quickly update all me Stored Procedures and sysObejcts etc to with with the new table name.

Many Thanks

Luke"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-05-17 : 07:53:51
You can search in syscomments for the tablename
select distinct object_name(id) from syscomments where text like '%tablename%'

hen update them.
You could also try dependencies in snterprise manager.
Neither is infallible.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-05-17 : 18:03:26
Hi,

Dont try to do updates in the system tables.

Just try this

EXEC sp_rename 'TableOLDNAMe', 'TableNewName'




With Regards
Sreenivas Reddy B
Go to Top of Page

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-05-18 : 02:14:32
quote:
Originally posted by SreenivasBora

Hi,

Dont try to do updates in the system tables.

Just try this

EXEC sp_rename 'TableOLDNAMe', 'TableNewName'




With Regards
Sreenivas Reddy B



Which would only rename the table and not do as the poster asked
"...quickly update all me Stored Procedures and sysObejcts etc"

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page
   

- Advertisement -