Tuesday, February 14, 2012

database triggers

Hello there
There are triggers for tables that work on table change.
Is there database triggers how work on database changes and database schema
changesIn SQL Server 2005, you now have DDL triggers.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:uvpiP18hGHA.4892@.TK2MSFTNGP02.phx.gbl...
Hello there
There are triggers for tables that work on table change.
Is there database triggers how work on database changes and database schema
changes|||Roy
What is the version are you using?
Tom has already answered your question. There is some example how it works
CREATE TRIGGER trg_capture_create_table ON DATABASE FOR CREATE_TABLE
AS
-- PRINT event information For DEBUG
PRINT 'CREATE TABLE Issued'
PRINT EventData()
-- Can investigate data returned by EventData() and react accordingly.
RAISERROR('New tables cannot be created in this database.', 16, 1)
ROLLBACK
GO
For more details please refer to the BOL
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:uvpiP18hGHA.4892@.TK2MSFTNGP02.phx.gbl...
> Hello there
> There are triggers for tables that work on table change.
> Is there database triggers how work on database changes and database
> schema changes
>|||Whell Uri
I'm working on sql 2000
can i build triggers for this on sql server 2000?
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OcDVuR9hGHA.1260@.TK2MSFTNGP05.phx.gbl...
> Roy
> What is the version are you using?
> Tom has already answered your question. There is some example how it works
> CREATE TRIGGER trg_capture_create_table ON DATABASE FOR CREATE_TABLE
> AS
> -- PRINT event information For DEBUG
> PRINT 'CREATE TABLE Issued'
> PRINT EventData()
> -- Can investigate data returned by EventData() and react accordingly.
> RAISERROR('New tables cannot be created in this database.', 16, 1)
> ROLLBACK
> GO
> For more details please refer to the BOL
>
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:uvpiP18hGHA.4892@.TK2MSFTNGP02.phx.gbl...
>|||Roy Goldhammer (roy@.hotmail.com) writes:
> I'm working on sql 2000
> can i build triggers for this on sql server 2000?
No.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx