简体   繁体   中英

How to Rename Column name of table in MS SQL

I have the column name ParentName and for now i want to rename that column name to Parent1FirstName , so what is the query of that rename column name of my table

    ALTER TABLE tbltable1
    Rename ParentName = 'Parent1FirstName';

您可以使用sp_rename ,如下所示。

EXEC sp_rename 'tbltable1.ParentName ', 'Parent1FirstName', 'COLUMN'

尝试如下

EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM