SQL Apprentice Question
have the following check constraint
(isnull(patindex(('%[' + ' ' + char(9) + char(10) + char(13) + ']%'),[LicensePlateNumber]),0) = 0)
which works fine, throwing an error if those characters are entered. Is there a way to have it not throw an error, but rather just remove the offending characters if entered?
No. Constraints are declarative and do not perform actions. I would
do this kind of thing inthe front end or in the inpout procedure.
Triggers will fire any time the table is touched and work on all rows,
so they can be a bit costly.