Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

create trigger Expand / Collapse
Author
Message
Posted Monday, December 20, 2010 11:45 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, August 6, 2014 10:46 PM
Points: 12, Visits: 84
Please help me,Its urgent.

Thanks in Advance
Post #1037515
Posted Monday, December 20, 2010 11:56 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
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
Post #1037521
Posted Tuesday, December 21, 2010 12:05 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, August 6, 2014 10:46 PM
Points: 12, 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.
Post #1037524
Posted Tuesday, December 21, 2010 12:16 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
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
Post #1037527
Posted Tuesday, December 21, 2010 12:17 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
You can refer: http://msdn.microsoft.com/en-us/library/ms189799.aspx

Thanks
Post #1037528
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse