Introduction:
In this article I will explain how to change or rename column name or table name in SQL server.
In previous posts I explained many articles relating to SQL Server. Now I will explain how to rename or change column name or table name in SQL Server.
From the above query declaration I am changing UserDetails
table name to UserInformation
By using above statements we can rename existing table in database or we can rename existing Column in table.
In this article I will explain how to change or rename column name or table name in SQL server.
Description:
In previous posts I explained many articles relating to SQL Server. Now I will explain how to rename or change column name or table name in SQL Server.
Syntax
to Change existing column name in data table
SP_RENAME 'TableName.[OldColumnName]'
, '[NewColumnName]', 'COLUMN'
|
Ex:
SP_RENAME 'UserInformation.[UserDetail]'
, '[UserName]', 'COLUMN'
|
From
the above query declaration I am changing the name of column UserDetail to UserName in table UserInformation.
Syntax
to Change table name
SP_RENAME '[OldTableName]'
, '[NewTableName]'
|
Ex:
SP_RENAME '[UserDetails]'
, '[UserInformation]'
|
By using above statements we can rename existing table in database or we can rename existing Column in table.
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
Subscribe by RSS
Subscribe by Email
1 comments :
not much explaination
Note: Only a member of this blog may post a comment.