Programmatically renaming a table in SQL Server 2000 - is sp_rename the only solution?

sql-server, sql-server-2000, t-sql

Solution

sp_rename is the correct way to do it.

EXEC sp_rename 'Old_TableName', 'New_TableName'

Problem

I recently had to rename a table (and a column and FK/PK contraints) in SQL Server 2000 without losing an data. There did not seem to be an obvious DDL T-SQL statements for performing this action, so I used sp_rename to directly fiddle with object names. Was this the only solution to the problem? (other, than give the table the correct name in the first place - doh!)

Original source