Rename user-created objects in SQL Server
Rename user-created object (for example, table, column, or user-defined data type) in the present database:Syntax:
sp_rename oldName, newName, [Object]
Rename Table
sp_rename 'Employee', 'Employees'
or
sp_rename 'Employee', 'Employees', 'TABLE'
Rename Column
sp_rename 'EName', '[Emp Name]', 'COLUMN'
1 Comments:
Hi Chandra,
The workable syntax for renaming a column is like following
sp_rename 'Employees.[EName]', 'Emp Name', 'COLUMN'
Post a Comment
<< Home