sql server rename

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 姓名:龚珊珊 公司:宁波大发化纤有限公司 《六项精进》301期感谢组学员 【日精进打卡第72天】 【知~学习】 《...
    Miss曲奇阅读 121评论 0 0
  • 跟月亮借的礼服 再高贵圣洁 也要被太阳收回
    遇见子鱼阅读 364评论 4 9
  • 《清平乐·咏蝉》 宋 陈德武 娇声娇语。恰似深闺女。 三叠琴心音一缕。躲在绿阴深处。 此音宁与人知。此身不与人欺。...
    猫恋一夏阅读 367评论 0 3
  • 姓名:张景方 公司:上海日朗门窗有限公司 反省一组 【日精进打卡第115天】 【知~学习】 《六项精进》诵读1遍共...
    威廉张豆豆爹阅读 177评论 0 0