Mega Code Archive

 
Categories / MSSQL / Constraints
 

Enable a column to optionally not require a value by designating it as a nullable column

1> -- Nullability 2> 3> -- Enable a column to optionally not require a value by designating it as a 4> -- nullable column. 5> 6> CREATE TABLE MyTable 7>      ( Category nVarChar(50) NOT NULL 8>      , MyDescription nVarChar(50) 9> ) 10> INSERT MyTable (Category) VALUES ('Category1') 11> 12> SELECT * FROM MyTable 13> GO (1 rows affected) Category                                           MyDescription -------------------------------------------------- ------------------------------- Category1                                          NULL (1 rows affected) 1> 2> drop table MyTable 3> GO 1>