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 |
|
cesark
Posting Yak Master
215 Posts |
Posted - 2003-09-19 : 05:34:14
|
I’ m trying to define specific data types with Check Constraints. I want to define a column so that only be able to enter a code consisting in eight numbers and one letter in capital, for instance: ‘25814712X’. I’ ve obtained successfully result except the letter that accept small letters, and I only want to accept capitals. The syntax is as follows:ALTER TABLE UsersADD CONSTRAINT CK_codeCHECK (User_code LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z]')How can I write it so that only be able to accept letters in capitals?How can I write a Check Constraint that only allows a characters set which contains the character ‘@’ between that, and finishes with ‘.com’, ‘.net’, ‘.uk’, ‘.fr’, ‘.org’, etc,..? I want user only be able to write the correct e-mail format .Thanks,Cesar |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2003-09-19 : 07:00:37
|
| have a look at the following links.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=24908http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=19229they might help overcome/get around your 2nd problem....ie the e-mail part.Alternative is to write a function...that does the validation.sometimes we can try to do too much in the database. |
 |
|
|
cesark
Posting Yak Master
215 Posts |
Posted - 2003-09-19 : 07:26:06
|
| Ok thank you,Cesar |
 |
|
|
|
|
|