杂七杂八之SQL
1.系统函数修改名称—sp_renamedb与sp_rename
1)更改数据库名sp_renamedb
语法:sp_renamedb [ @dbname = ] 'old_name' ,[ @newname = ] 'new_name'
示例:EXEC sp_renamedb 'test' , 'TESTDB'
2)更改表名或列名
语法:sp_rename [ @objname = ] 'object_name' ,
[ @newname = ] 'new_name'
[ , [ @objtype = ] 'object_type' ]
备注: [ @objtype = ] 'object_type'
示例:重命名表 EXEC sp_rename 'customers' , 'custs'
重命名列 EXEC sp_rename 'customers.[contact title]' , 'title' , 'COLUMN'