SYNTAX of altering table : Alter Table « Table « SQL Server / T-SQL






SYNTAX of altering table

 



ALTER TABLE table-name ALTER COLUMN column-name
        { type_name [ ( prec [, scale] ) ] [COLLATE <collation name> ]
          [ NULL | NOT NULL ]
          |  {ADD | DROP} ROWGUIDCOL }

15> CREATE TABLE employee
16> (
17> emp_id      int            NOT NULL PRIMARY KEY,
18> emp_name    varchar(30)    NOT NULL,
19> mgr_id      int            NOT NULL REFERENCES employee(emp_id)
20> )
21> GO
1>
2> ALTER TABLE employee
3> ALTER COLUMN emp_name varchar(50)
4> GO
1>
2> drop table employee;
3> GO
1>

 








Related examples in the same category

1.Alter table to change column data type