Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
learntsql
524 Posts |
Posted - 2010-05-15 : 02:21:20
|
Hi All,How to create check constraint to restrict the user to enter first character from A-Z second from 0-9, third from A-Z?TIA. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-15 : 03:47:46
|
ALTER TABLE tablename ADD CONSTRAINT CHECK (column LIKE [A-Z][0-9][A-Z])------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
learntsql
524 Posts |
Posted - 2010-05-15 : 05:49:12
|
Hi Visakh,I tried as"ALTER TABLE CheckCon ADD CONSTRAINT CHECK (CName LIKE [A-Z][0-9][A-Z])"I am getting error as"Incorrect syntax near the keyword 'CHECK'."Plz. look at it. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-16 : 08:15:50
|
[code]ALTER TABLE tablename ADD CONSTRAINT chk_column_name CHECK ([column_name] LIKE '[A-Z][0-9][A-Z]')[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
learntsql
524 Posts |
Posted - 2010-05-17 : 00:36:05
|
ThankQ. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-17 : 12:21:03
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|