[dba-SQLServer] CHECK example

Susan Harkins ssharkins at gmail.com
Mon Jan 21 10:24:43 CST 2008


I swear, I haven't been able to do anything in SQL Server this weekend. ;(

I want to add a simple CHECK constraint, programmatically to a column and 
I've reviewed the syntax for ALTER TABLE And CONSTRAINT and it's clear as 
mud.

TableName: dbo.PostalCodes
ColumnName: PostalCodeExtended
DataType: varchar(9)
Constraint definition: (PostalCodeExtended LIKE 
'[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]')

I just can't get it -- I can't find anyplace in the syntax to actually 
define the constraint.

Susan H. 




More information about the dba-SQLServer mailing list