EXEC sp_rename 'T', 'T_old' : sp_rename « System Functions « SQL Server / T-SQL Tutorial






2> IF EXISTS(SELECT name FROM sys.tables
3>     WHERE name = 'T')
4>     BEGIN
5>         PRINT 'T already.'
6>         DROP TABLE T_old
7>         EXEC sp_rename 'T', 'T_old'
8>     END
9> ELSE PRINT 'No T already.'
10>
11> CREATE TABLE T (
12>     c1 bigint,
13>     c2 nvarchar(max)
14> )
15>








25.53.sp_rename
25.53.1.sp_rename department, subdivision
25.53.2.EXEC sp_rename 'T', 'T_old'