Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 669 Bytes

rename-column.md

File metadata and controls

12 lines (9 loc) · 669 Bytes

Rename a Column in SQL Server

Trying to rename a column today in an MSSQL database. I expected the standard ALTER TABLE x CHANGE oldColumn newColumn <type> to work, but apparently that's a MySQL-only thing? Instead I did a quick Google search and came up with this nugget:

EXEC sp_rename
    @objname = "pages.permalink",
    @newname = "slug",
    @objtype = "COLUMN";

Thanks to DustyReagan.com, or check out the full docs for sp_rename in Transact-SQL.