Questions tagged [ddl-trigger]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
46 views

SQL-Server schema audit trigger - possible to get old view/sp/function definition?

I'm using the below database-level trigger for schema-change-auditing. It works fine, but if I do (drop view - create view), it only stores the sql that created the view, not the one that is dropped. ...
1
vote
2answers
114 views

Trigger to update only if value is in lookup table

I only want to update the comment if a description for the event is found in the TagDescLookup Table. If the Tag isn’t in the Lookup table then don’t change the existing Value for the comment column. ...
0
votes
1answer
41 views

How to trigger a function with DDL query?

I want to add a few sanity checks on my DDL statements. Unfortunately, I cannot run a validation separately due to some constraints. I am thinking to run validation inside the DB by calling a stored ...
2
votes
1answer
89 views

How to Deny permissions for newly created user in DDL Trigger?

I'm having trouble with a SQL DDL trigger for Create_User and I'm wondering if there is an issue with my syntax or something else I'm not seeing? I have some tables in my database which are only ...
0
votes
1answer
35 views

Trigger to log Users Assigned to website

Is it possible to create a trigger so that works with the following scenarios: User types valid login info to the web application A trigger is activated and login name is inserted to the audit ...
-1
votes
2answers
63 views

mysql trigger data from a many to many relation

I am new to triggers, so I want to know how I could select attributes from 3 different tables to insert them into a new table. I have 3 tables with a many to many relationship: table users wich has ...
0
votes
1answer
50 views

Oracle schema object name when fire trigger

I need to get the object name and user name from oracle schema after fire a trigger. It executes on DDL statements. I need to get executed user name and object name which trigger executed on. Below is ...
1
vote
0answers
39 views

Create a table via an INSERT trigger in MariaDB

I'm trying to make a small database I can use to log changes I make to configuration files on various Linux systems. My thought was have a Database named for the system, and then a table called ...
0
votes
1answer
109 views

Does the SQL Standard mention trigger events on DDL (ALTER, CREATE, DROP)?

PostgreSQL supports "Event Triggers" which is defined as, To supplement the trigger mechanism discussed in Chapter 39, PostgreSQL also provides event triggers. Unlike regular triggers, which are ...
0
votes
1answer
50 views

failed logon trigger blocking access into SQL Server instance

I wanted to create a trigger to record all the names of logins(who logon into system) in ServerLogonRecords table(all the columns are nullable) using LOGON trigger. I get information using eventdata() ...
1
vote
1answer
107 views

Create DDL Trigger Dynamically

I'm trying to create a DDL Trigger dynamically so I can create a job that checks each database and creates the trigger if it's not already in place. To do this, I'm using sp_foreachdb. The code works ...
3
votes
2answers
549 views

DDL Trigger in MySQL?

Are there any options for running DDL triggers in a MySQL database. I would like to create a view every time someone create a table. If the "Users" table is created, I want the DDL trigger to create ...
0
votes
1answer
26 views

DDL Trigger for ALTER any object

Is there a way to make a DDL trigger which fires on ALTER of any object? So far the only way I see to do this is enumerate each object type (e.g. ALTER_TABLE, ALTER_PROCEDURE, etc) when what I'd ...
0
votes
1answer
47 views

Trigger reading from two view tables and write on a different table takes more than 12 seconds, what might be the issue here?

Trigger reading from two view tables and write on a different table takes more than 12 seconds, what might be the issue here? In my case, I am using a trigger to read from two view tables (Decisions2 ...
8
votes
1answer
261 views

How can I resolve a database trigger's name with built-in functions?

I have a database trigger that I use to prevent me from creating certain procedures in user databases. It appears in sys.triggers, with an object_id, but I can't use the object_id function to find it....
0
votes
1answer
217 views

How can I RAISE_APPLICATION_ERROR and do an INSERT in the same trigger?

From what I see, having the RAISE_APPLICATION_ERROR cancels the other operations that I would have in the trigger. I tried writing first the INSERT and then the RAISE_APPLICATION_ERROR hoping that ...
0
votes
1answer
38 views

How can I create a trigger that prevents column delete, data deletion and table truncate in the same time?

Having written this trigger create: CREATE OR REPLACE TRIGGER PROTECT_DB BEFORE DROP OR TRUNCATE ON X.SCHEMA How can I "add" a DELETE in the trigger definition ? (the DELETE should prevent data ...
0
votes
2answers
330 views

Mysql trigger to update if date match and insert if no match all BEFORE INSERT

please pardon my English i am using language translator. I have a table summary ,i want a TRIGGER to fire before insert on this table i.e summary and what i want is that, the TRIGGER should check if ...
1
vote
2answers
69 views

Is dropping foreign key constriants an event in Oracle?

I wrote the following trigger in Oracle: create or replace trigger foreign_drop before ddl on database begin insert into ddl_log select ora_sysevent, ora_dict_obj_owner, ora_dict_obj_name, null, ...
4
votes
1answer
182 views

PostgreSQL event trigger to force extension installations into particular schema

I have a dedicated schema extensions (PostgreSQL v 9.6.3) where I intend to install all extensions for my DB. I would like to somehow disallow (or at least remind) users installing extensions without ...
2
votes
0answers
338 views

Create event trigger as non-superuser in Postgres

Is it possible to give a role or a set of attributes to a non-superuser in postgres that would allow the user to create an EVENT TRIGGER? Simple example of what (obviously) doesn't work in psql: =&...
3
votes
1answer
289 views

DDL Trigger not working as expected SQL Server 2012

I have a DDL Trigger in SQL Server 2012 as: CREATE TRIGGER [AuditProcChanges] ON DATABASE FOR CREATE_TABLE,ALTER_TABLE,DROP_TABLE AS DECLARE @message_body XML SET @message_body = EVENTDATA() ...