November 24, 2010 at 6:37 am
I have a table called IntNotes that including column Key,Notes,Keytable and few others.
Key is Primary Key.
Notes - Nvarchar(max),not null)
I have a check constraint on Notes column.
ALTER TABLE [dbo].[IntNotes] WITH NOCHECK ADD CHECK ((NOT [Notes] like '' AND NOT [Notes] like ' %' AND NOT [Notes] like '% ')).
But when i am adding following values getting error
"Error occured storing IntNotes data, the Violated constraints follows.[Notes] like '' AND NOT [Notes] like ' %' AND NOT [Notes] like '% "
Value
KeyTable = 881
Key =2250
Notes = 'Received signed 3yr contract priced at $12500/13500/14250. please send invoice for $12,500'.
Can anyone suggest me what steps should i have to follow?
Thanks you
November 24, 2010 at 6:43 am
i think you want something more like this: the field cannot be trimmed to equal whitespace, and must have at least a letter or number in it
ALTER TABLE [dbo].[IntNotes] WITH NOCHECK
ADD CHECK (NOT LTRIM(RTRIM([Notes])) = ''
AND [Notes] like '%[^a-z,A-Z,0-9]%')
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply