Tuesday, June 23, 2015

Rename a column on a table in MSSQL.

EXEC sp_rename 'Bar.FooId', 'BarId', 'COLUMN'

...is the way to go. Note that we are again using the sp_rename sproc. In this example rename a column in the Bar table sort of assuming we just renamed the table itself to Bar from Foo just beforehand.

No comments:

Post a Comment