Hi,
is this the best way?
ALTER TABLE MyTable
ADD CONSTRAINT CK_MyTable_NoSpace
CHECK (charindex(' ', MyColumn)=0)
Is there any other way?
Thnx
Not sure but you can also try NOT LIKE '% %'
Try them both. What is the reason you need this?
|||Thanks Simon
It would have to be trimmed first no?SimonSa wrote: NOT LIKE '% %'
or maybe:
NOT LIKE '% %' AND NOT LIKE '% ' AND NOT LIKE ' %'
File system entries. The OS allows them but I want to restrict them. It is also being done in the DAL.|||SimonSa wrote: What is the reason you need this?
It would have to be trimmed first no?Carl M. wrote: Thanks Simon
SimonSa wrote:
NOT LIKE '% %'
or maybe:
NOT LIKE '% %' AND NOT LIKE '% ' AND NOT LIKE ' %'
No. % can stand for any number of characters, even none. NOT LIKE '% %' would be correct.
|||Thank you.
No comments:
Post a Comment