sql server rename

作者: 天天向上卡索 | 来源:发表于2019-03-13 17:02 被阅读2次

sql server rename

Intro

有时候我们可能会需要重命名表名称或列名称,这里就是解决方案

sometimes we may wanna rename the table name or the column name, here's the solution.

Caution

Changing any part of an object name can break scripts and stored procedures. We recommend you do not use this statement > to rename stored procedures, triggers, user-defined functions, or views; instead, drop the object and re-create it with the new > name.

execute sql

rename a table name:

重命名表名

exec sp_rename 'schema.old_table_name', 'new_table_name'
-- To rename a column:
sp_rename 'table_name.old_column_name', 'new_column_name' , 'COLUMN';

-- To rename a table:
sp_rename 'old_table_name','new_table_name';

Reference

相关文章

网友评论

    本文标题:sql server rename

    本文链接:https://www.haomeiwen.com/subject/qyytmqtx.html