Hot answers tagged

11 votes
Accepted

OUTPUT clause returning 0 for newly inserted identity value due to INSTEAD OF trigger

The behaviour is confusing and poorly documented. It used to be slightly better documented in INSTEAD OF INSERT Triggers (link to 2008 R2 docs): The explanation is that at the time the values are ...
Paul White's user avatar
  • 83.7k
5 votes

OUTPUT clause returning 0 for newly inserted identity value due to INSTEAD OF trigger

It's behaving as documented. Relevant quote: OUTPUT clause (Transact-SQL) For INSTEAD OF triggers, the returned results are generated as if the INSERT, UPDATE, or DELETE had actually occurred, even ...
Zikato's user avatar
  • 4,418
2 votes
Accepted

Prevent users from sending an email attachment in sql server

I couldn't find a way to prevent it, but I created a trigger to send an email when someone sends attachment. It works fine for me. CREATE OR ALTER TRIGGER trg_attachment_notification ON msdb.....
Farid Zahidov's user avatar
1 vote

Module signing on a trigger which accesses system views. Base table is on a custom schema

First of all, when I reproduce using your code - I have a different message: Msg 300, Level 14, State 1, Procedure AuditINSERT, Line 9 [Batch Start Line 0] VIEW SERVER PERFORMANCE STATE permission ...
Zikato's user avatar
  • 4,418

Only top scored, non community-wiki answers of a minimum length are eligible