views:

207

answers:

1

I have a table on which there is update trigger written it has print statement before go statement.

ALTER TRIGGER user_type_check ON user_table
    --code

    PRINT 'Modification of user is done.'
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


Now with this structure whenever i perform update operation on the table it failed.

However when i moved the PRINT statement after the go statement in the trigger its working fine without error. Why is such a behavior ?

A: 

Would be more interesting to see the code that actually could produce the error in your subject. PRINT is unlikely to generate such error.

Why are you using a PRINT in a trigger instead of a RAISERROR? What are you trying to achieve?

Btw, the reason why you don't get an error when you move the PRINT after the GO is that it is then no longer in the trigger definition

Frank Kalis