September 4, 2013 at 10:51 am
Show how someone can use a DDL trigger to audit all CREATE TABLE statements in all databases on a server.
September 4, 2013 at 11:54 am
I can tackle this. I have a good one in place in all of my databases. The script has been passed around the block many times.
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
September 4, 2013 at 12:02 pm
Great. Thanks and submit it when you can.
January 31, 2014 at 11:15 am
bump
February 28, 2014 at 1:37 pm
I will give it my best rookie attempt.
March 3, 2014 at 9:14 am
Thanks, after about 3-4 weeks, I'll bump this for a reminder
March 19, 2014 at 12:04 pm
sorry for the delay. the rough draft is complete. I will submit be end of the week.
March 19, 2014 at 12:21 pm
Steve Jones - SSC Editor (9/4/2013)
Show how someone can use a DDL trigger to audit all CREATE TABLE statements in all databases on a server.
Somehow I feel like there is more to this question, but a server level DDL trigger can do what you're asking.
http://technet.microsoft.com/en-us/library/ms186406(v=SQL.105).aspx
CREATE TRIGGER ddl_trig_database
ON ALL SERVER
FOR CREATE_DATABASE
AS
...
...
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
March 19, 2014 at 12:26 pm
Eric M Russell (3/19/2014)
Steve Jones - SSC Editor (9/4/2013)
Show how someone can use a DDL trigger to audit all CREATE TABLE statements in all databases on a server.Somehow I feel like there is more to this question, but a server level DDL trigger can do what you're asking.
http://technet.microsoft.com/en-us/library/ms186406(v=SQL.105).aspx
CREATE TRIGGER ddl_trig_database
ON ALL SERVER
FOR CREATE_DATABASE
AS
...
...
Agreed, and that is what I use on our environments. There is some value in separate triggers for business logic,etc, but if you are just logging the event the "all" approach is the way to go. I included and index change in my test script to demonstrate that you may not get what you expect unless you read the chart correctly.
March 20, 2014 at 1:39 pm
Having an article that explains how this works, more than BOL reference, is the request. If you want to do this at a database level as well, please feel free.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply