Tuesday, May 21, 2013

How to Change Column Name in Sql Server

In Query Analyzer write the below Code

sp_rename '<TableName>.<OldColumnName>','<NewColumnName>','<Column>'

Example:::--> our column name is 'ProductId' in tbProducts table name, if we want to change this column to 'ProductName' then do the below process.

sp_rename 'tbProducts.ProductId','ProductName','column'


No comments:

Post a Comment