Friday 2 July, 2010

How to Alter ColumnName in sql server with query..

We are normally using Alter Column Modify command to modify the column defination. But SQL Server does not support it. Rather then then that they are are supporting new syntax Like

"ALTER TABLE ALTER COLUMN"

Here is the syntax for ALTER TABLE command for sql server.

ALTER TABLE table { [ ALTER COLUMN column_name { new_data_type [ ( precision [ , scale ] ) ] [ COLLATE <> ] [ NULL NOT NULL ] {ADD DROP } ROWGUIDCOL } ] ADD { [ <> ] column_name AS computed_column_expression } [ ,...n ] [ WITH CHECK WITH NOCHECK ] ADD { <> } [ ,...n ] DROP { [ CONSTRAINT ] constraint_name COLUMN column } [ ,...n ] { [ WITH CHECK WITH NOCHECK ] CHECK NOCHECK } CONSTRAINT { ALL constraint_name [ ,...n ] } { ENABLE DISABLE } TRIGGER { ALL trigger_name [ ,...n ] } }

If you want more to know about it. Please visit following link at Micorosft sql server developement center.

http://msdn2.microsoft.com/en-us/library/aa275462(SQL.80).aspx

No comments:

Post a Comment