Wednesday, March 21, 2012

Rename a table in Microsoft SQL Server 2005

hi,
Can you give the query in MS SQL Server 2005 which can be used to rename a existing table in database.
Thanks in advance,SELECT *
INTO NewTable
FROM OldTable

DROP TABLE OldTable

Keep in mind that you may need to rebuild constraints depending on the table. You can also use sp_rename, which I believe does the same thing as the sql above.

No comments:

Post a Comment