Wednesday, March 7, 2012

Question About a Check Constraint

I am attempting to write a Check Constraint on an MSSQL2k server that will only allow a string to be INSERTED or UPDATED if it is formatted correctly.

The correct format being, that the first character is uppercase [A-Z], and any trailing characters [a-z] in the word are lowercase, unless there is a space. If there is a space, the next character after the space should be uppercase [A-Z], and any trailing characters in the word will be lowercase[a-z]. Punctuation should also be allowed.

I know a function can be written to make sure that when INSERTS and UPDATES are performed, that the strings are manipulated to conform to this requirement. The problem is that I am not going to be the person that writes these functions, and I was hoping to create this constraint as an extra level of verification, but I am not even sure that this is possible.

So now the questions:
1.) Is this possible
2.) Could someone write me an example.

Thanks in adance.
-JohnDid you find a solution? If not, do you need more?

No comments:

Post a Comment