SQL Apprentice Question
I have a column that I do not want any whitespace in whatsoever. I'm
wondering how do enforce this a DDL level instead of in 40 million
seat-of-the-pants after-the-fact computer programs accessing the
database.
Celko Answers
CONSTRAINT no_white_space
CHECK ( LEW(foo) = LEN (REPLACE (foo, ' ', '')))
You can then nest calls to REPLACE() for tabs,newlines, etc. easily.
Thursday, November 16, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment