Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Triggers on text fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-21 : 11:23:39
Alena writes "Hi,
I need to set up an insert/update trigger on a text field, but when I try to do that, I get an error message: Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables.
My code looks like this (the names have been changed to protect their privacy):


CREATE TRIGGER MyTrigger ON [dbo].[MyTable]
FOR INSERT, UPDATE
AS
IF UPDATE (MyTextDataField)
BEGIN
IF (SELECT MyTextDataField FROM inserted) LIKE ''
BEGIN
ROLLBACK TRANSACTION
PRINT 'Cannot save empty data'
END
END

Could you please help? Thank you!!!"
   

- Advertisement -