Reputation: 49
I'd like to have an Update Trigger that will let user update first part of the name but will will prevent the last part from being removed.
For example I have a column Srt_Name with CAR_GID23232 entry.
User should not have possibility to remove '_GID23232' part. Here's what I came to, but it doesn't work:
IF EXISTS (
SELECT Srt_Name,Srt_Id
FROM inserted
WHERE Srt_Name not like '%_GID'+CONVERT(varchar(max),Srt_GidNumer)
)
BEGIN
RAISERROR ('Make sure that name ends with _GIDXXXX pattern.', 16, 1)
END
Upvotes: 0
Views: 72
Reputation: 3520
Try this one :
IF EXISTS (
SELECT Srt_Name,Srt_Id
FROM inserted
WHERE Srt_Name not like '%[_]GID'+CONVERT(varchar(max),Srt_GidNumer
)
Upvotes: 5