Thursday, 20 November 2014

Rename Column



    Using SP_RENAME we can rename columns.

Rename Column:
Syntax:
SP_RENAME '<Database name>.<Schema name>.<Table Name>.<Column Name>','<New Name>'

Example:
Table Creation:


CREATE TABLE SAMPLE14
(
ID INT ,
NAME VARCHAR(10),
TYPE_DESC VARCHAR(50)
)

Renaming Table:



SP_RENAME 'KIRAN.DBO.SAMPLE14.ID','EMP_ID'



No comments:

Post a Comment