New answers tagged

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
0 votes

Prevent users from sending an email attachment in sql server

you cannot prevent, specially sysadmins to use the sp_send_dbmail procedure with or without attachments but you can see who did what and when, and if there were attachments or not. check this out ...
Marcello Miorelli'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,403
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,403
0 votes

Postgres insert into `select distinct` view if not exists

Let's say that the view is defined as CREATE VIEW event_items AS SELECT DISTINCT item FROM events; Writing a trigger like that is not difficult; the problem is that such triggers always suffer from ...
Laurenz Albe's user avatar
  • 50.3k
0 votes

Syntax error in simple trigger

The best way to implement this is calculated field: create table Quote_Base ( Fld_QuoteNumberRoot string, Fld_Revision integer, Fld_QuoteNumber string ...
Slava Rozhnev's user avatar
0 votes

Syntaxis Problem when creating a trigger in Mysqlite

It is always good to split long queries to multi-line: c.execute("""CREATE TRIGGER ahoraSI BEFORE INSERT ON Productos FOR EACH ROW BEGIN ...
White Owl's user avatar
  • 752
1 vote

SQLite - Update of a field in two steps without variable (SpatiaLite)

There was an issue with SELECT CASE, on the second update of NOM_SCIENT_VALIDE. Here is the updated trigger : CREATE TRIGGER update_espece_trigger AFTER UPDATE OF COMPART ON ESPECES_ATTRIBUTS ...
Giene's user avatar
  • 121

Top 50 recent answers are included