Posted by Dan Guzman on 10/02/06 12:26
One method is with a CHECK constraint that checks for the list of your
prohibited characters. You may need to scrub data before adding the
constraint.
ALTER TABLE MyTable WITH CHECK
ADD CONSTRAINT CK_MyTable_MyColumn
CHECK (MyColumn LIKE '%[^' + CHAR(32) + CHAR(13) + CHAR(10) + CHAR(9) +
']%')
WITH CHECK
GO
--
Hope this helps.
Dan Guzman
SQL Server MVP
"metaperl" <metaperl@gmail.com> wrote in message
news:1159777716.594197.268970@e3g2000cwe.googlegroups.com...
>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.
>
> Regards,
> Terrence
>
Navigation:
[Reply to this message]
|