May 28, 2009 at 9:02 am
Hi All
I am trying to create a DDL trigger to monitor tables, procedures views and functions, when i include the events below on trigger creation it throws an exception that its not valid
CREATE TRIGGER ddltrg_CREATE_TABLE_LOG ON Database1
FOR CREATE_TABLE,ALTER_TABLE,DROP_TABLE,CREATE_PROCEDURE,ALTER_PROCEDURE,DROP_PROCEDURE,CREATE_VIEW,ALTER_VIEW,DROP_VIEW,CREATE_FUNCTION,ALTER_FUNCTION,DROP_FUNCTION
What is the obvious i am missing here:-)
Thanks for your response 🙂
May 28, 2009 at 9:08 am
could you post the exact error and all the code for the trigger please
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
May 28, 2009 at 9:09 am
Hi Chris , thanks for the reply
Msg 1098, Level 15, State 1, Procedure ddltrg_CREATE_TABLE_LOG, Line 28
The specified event type(s) is/are not valid on the specified target object.
This is the message i get when i try to create a trigger 🙂
May 28, 2009 at 9:15 am
try and remove the "1" from DATABASE1 and just have it say ON DATABASE
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
May 28, 2009 at 9:18 am
DAtabase1 is the database Name, so that cant be changed:-)
May 28, 2009 at 9:20 am
As I understand it , you always specify ON DATABASE and simple make sure that you run it on the correct DATABASE
if that make sense?
USE [MyDB]
GO
CREATE TRIGGER ddl_log ON DATABASE
FOR CREATE_TABLE
AS
....
GO
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
May 28, 2009 at 9:22 am
Ops that's my mistake, It worked, Thanks a LOT 😀
May 28, 2009 at 9:27 am
no problem at all 😉
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply