Changing column name using DBCC statement

Posted by Sanyok under Sql Server on 3/23/2010 | Views : 2122 | Status : [Member] | Replies : 1
Hello all

Is there any way to change the column name of Table(Table1) using DBCC statement only ?

Table name : Table1
Column Name : SerialNo

The column name has to be changed to Slno.

waiting for perfect answer.

thanks in advance
Sanyok K




Responses

Posted by: Pandians on: 3/23/2010 [Member] [MVP] Silver

Up
0
Down
Hi Sanyok

Greetings

YES. You can use a DBCC statement : DBCC RenameColumn. But this is Un-Documented, You can simply use SP_Rename instead.

Syntax:
DBCC RenameColumn (TableName,ExistingColumnName,NewColumnName)

ie:
DBCC RenameColumn (Table1,SerialNo,Slno)


Cheers



Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Sanyok, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response