Return to Snippet

Revision: 56883
at April 20, 2012 01:45 by denakitan


Initial Code
ALTER TABLE
	GhibliMovies
ADD
	Director VARCHAR(255) NULL
CONSTRAINT
	director_check CHECK (Director in ('Hayao Miyazaki', 'Isao Takahata', 'Yoshifumi Kondo', 'Goro Miyazaki', 'Hiromasa Yonebayashi'))
DEFAULT
	'Hayao Miyazaki' with values;

Initial URL
http://msdn.microsoft.com/en-us/library/ms190273.aspx

Initial Description
Example of SQL syntax to add a new column to an existing table, define a default value to the columns for the existing rows and also add a check constraint to limit the values that the column can hold.

Initial Title
SQL - SQL Server - Add Column with Default Value and Check Constraint

Initial Tags
sql, table, server

Initial Language
SQL