4

How do I set "set nocount on" for a trigger? When I set it in the trigger and open the trigger code, I see it has disappeared! My requirement to set the statement comes from below:

I am using Java third party API to make a SQL "UPDATE" statement. The table being updated has a trigger on it which is causing the following failure:

"com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update."

If I disable the trigger, the issue disappears. If the UPDATE statement is run by itself there are no errors.

My questions is how can I set "SET NOCOUNT ON"?? If I modify the trigger and add this line, and open the trigger again, I notice that the "nocount on" statement has disappeared.

I am unable to set it at "server" level as I do not have permission to do this.

Thanks! Bruce

Bruce
  • 2,133
  • 12
  • 34
  • 52

0 Answers0