参考代码如下:
use [Database Name]
go
--先检查表是否存在,再使用内置存储过程修改表名
if exists (select 1
from sysobjects
where id = object_id('Table Name')
and type = 'U')
exec sp_rename 'Table Name','New Table Name';
go
参考代码如下:
use [Database Name]
go
--先检查表是否存在,再使用内置存储过程修改表名
if exists (select 1
from sysobjects
where id = object_id('Table Name')
and type = 'U')
exec sp_rename 'Table Name','New Table Name';
go