kapil_kk (7/23/2013) Hugo Kornelis (7/23/2013)
Can someone please throw more light on this statement-
DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause
Which part of the statement do you not understand?
I am not getting by the statement part -
DML statement cannot have any enabled triggers..............
Ah, now I see the confusion. That looks as if a few words were cut off at the start (triggers are created for tables and views, not for statements. so I suspect that this sentence should have started with "The target of the DML statement ...
Or we can go with the explanation in Books Online:
"If the OUTPUT clause is specified without also specifying the INTO keyword, the target of the DML operation cannot have any enabled trigger defined on it for the given DML action".
In other words - if the statement causes a trigger to fire, it should have either no OUTPUT clause or an OUTPUT clause with an INTO keyword. Using the OUTPUT clause without INTO (so that the results of the OUTPUT specification go to the client) is not allowed when a trigger fires.
Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis