For one of my columns I am trying to enforce a pattern. The first letter should be
D upper case, and the remaining 3 characters should be digits. For example:
I'm quite new with
CHECK constraints and things like regular expressions.
Below is what I've done so far, which (I think) enforces the general pattern. However when I try adding something like
d900 it works, even though it's a lower case d. I expected this to fail.
Can someone please assist:
CREATE TABLE Systems( SystemsID NVARCHAR(4), Title NVARCHAR(30), CONSTRAINT chk_SystemsID CHECK (SystemsID LIKE '[D][0-9][0-9][0-9]'));