Profile

Friday, 29 July 2011

SQL Rename column on table

Using sp_RENAME in SQL we can rename table name, and column name on the fly:

     USE AdventureWorks
     GO
     sp_RENAME
     'Person.Address.AddressLine1', 'Addresslin01', 'COLUMN'
     GO

The above statement using a sample table to rename a column from 'AddressLine1' to 'Addresslin01'

No comments: