Friday 3 February 2012

how to rename a column or table in SQL SERVER


how to rename a column or table in SQL SERVER


Here I will tell you how to rename existing table in SQL Database and existing Column in table in SQL Server 

/*To rename a column*/

sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'

/*To rename a table*/

sp_RENAME '[OldTableName]' , '[NewTableName]'



By using these two statements we can rename existing table in database or we can rename existing Column in table.

No comments:

Post a Comment