SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


create trigger


create trigger

Author
Message
praveen.gln1
praveen.gln1
SSC-Enthusiastic
SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)

Group: General Forum Members
Points: 120 Visits: 84
Please help me,Its urgent.

Thanks in Advance
Hardy21
Hardy21
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4762 Visits: 1399
praveen.gln1 (12/20/2010)
Please help me,Its urgent.

Thanks in Advance


can you please post what is the issue & which type of help do you require?
Create trigger related help is available at: http://msdn.microsoft.com/en-us/library/ms189799.aspx

Thanks
praveen.gln1
praveen.gln1
SSC-Enthusiastic
SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)SSC-Enthusiastic (120 reputation)

Group: General Forum Members
Points: 120 Visits: 84
here is my issue

Am Produciton DBA and supporting 150+ servers(prod,DEv,UAT).i want to know about the users and database details who will create new databases on DEV machines.i require this for my documentation purpose.
If i will have trigger like this which sends mails to my alias then it will be easy for me to keep track of new database creation. I will be more help ful if i get script for deletion too.
Hardy21
Hardy21
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4762 Visits: 1399
praveen.gln1 (12/21/2010)
here is my issue

Am Produciton DBA and supporting 150+ servers(prod,DEv,UAT).i want to know about the users and database details who will create new databases on DEV machines.i require this for my documentation purpose.
If i will have trigger like this which sends mails to my alias then it will be easy for me to keep track of new database creation. I will be more help ful if i get script for deletion too.

You can create DDL Trigger on the server which you want to monitor.

Following trigger will fire whenever any user is creating the database on the server where you have created the trigger:


CREATE TRIGGER ddl_trig_database
ON ALL SERVER
FOR CREATE_DATABASE
AS
PRINT 'Database Created.'
GO


You can enhance the trigger as per your requirement.
you can also drop the database the same way.

Thanks
Hardy21
Hardy21
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4762 Visits: 1399
You can refer: http://msdn.microsoft.com/en-us/library/ms189799.aspx

Thanks
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search