Altering column name in MS SQL Server using sp_rename
Hi there,
Hope you are doing well.
Below is the script to rename the column in a table in MS SQL server using the sp_rename stored proc.
EXEC sp_rename 'TableNameIncludingSchemaName.oldColumnName', 'NewColumnName', 'COLUMN';
Example:-
EXEC sp_rename 'dbo.Employee.FName', 'FirstName', 'COLUMN';
FName is the current/existing column name and the FirstName is the new/desired column name.
Comments
Post a Comment