ViewState with example in C#

Monday, January 31, 2011

How to rename the column in sqlserver2005

I often get request from blog reader for T-SQL script to rename database table column name or rename table itself.
1:-The script for renaming any column :
sp_RENAME 'TableName.[OldColumnName]' '[NewColumnName]''COLUMN'
example:- sp_Rename 'employee.eid','employeeid','column'
2:-The script for renaming any object (table, sp etc) :
sp_RENAME '[OldTableName]' '[NewTableName]'
example:- sp_Rename 'employee','newemployee'

1 comment: