Wednesday, March 28, 2012

Need Help : Constraint

Dear All,
I want to create contraint for a column in a table with some formula
like this:
- First Character must be 'A'..'E'
- Second and third characters must be '00' .. '20'
How to make constaint as formula above?
Thanks
Robert LieHi
Posting your current DDL and example data will make your requirements less
ambiguous. but something like this may help
CREATE TABLE [MyTable] (
[col1] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
CONSTRAINT [CK_Col1] CHECK ([col1] like '[A-E][0-2][0-9]
%')
)
GO
John
"Robert Lie" wrote:

> Dear All,
> I want to create contraint for a column in a table with some formula
> like this:
> - First Character must be 'A'..'E'
> - Second and third characters must be '00' .. '20'
> How to make constaint as formula above?
> Thanks
> Robert Lie
>

No comments:

Post a Comment