Friday, March 30, 2012

Renaming column

ALTER TABLE ISMPBI CHANGE `PBICCGRFNUM` `PBICCGRFNUM1` BIGINT NOT NULL;
this query to rename column name in my sql but not working in sql server
so what is exact syntax to rename columnSee the syntax for the ALTER TABLE command in the online manual (http://msdn2.microsoft.com/en-us/library/ms190273.aspx)

Btw: don't use the backticks. They are a MySQL "speciality" and do not work with any other DBMS (actually they are not needed in MySQL as well)|||MS SQL SERVER does not support RENAME syntax i cant find the syntax to rename column can any one give me exact syntax to rename column|||The ALTER TABLE documentation links to the sp_rename (http://msdn2.microsoft.com/en-us/library/ms188351.aspx) function:
Changes the name of a user-created object in the current database. This object can be a table, index, column, alias data type
Example B: "renaming a column"|||thanks

here is exact syntax

EXEC sp_rename 'BFMENUDEFINITION.[GROUP]', 'MENUGROUP', 'COLUMN';

'BFMENUDEFINITION== tablename

GROUP == old column

'MENUGROUP'== new columnsql

No comments:

Post a Comment