Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-01-17 : 11:07:16
|
| offwYtE writes "I would like to track when a table is added or deleted from a database to launch a trigger.The only way I could come up with was adding a trigger to the sysobjects table. I tried adding a trigger to this table but kept getting a permissions denied.Is there any way to trigger an event when a table is added or removed from the database??" |
|
|
smccreadie
Aged Yak Warrior
505 Posts |
Posted - 2002-01-17 : 12:01:21
|
| This is probably not the answer you want, but setting up separate development and production environments with security is a good start. That way your developers could add tables all they want but there's a process to move them to production. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-01-17 : 13:58:33
|
| You could write a job to run at an specific interval (1 min, 5 min, 10, etc.) to query sysobjects and look for any new objects that were added since the last check. This is preferable to messing with the system tables anyway, since you could FUBAR your entire SQL Server by modifying them in any way. If the query finds anything then you could have it send an alert or take other action.I'm not well versed in alerts, but there might actually be a counter for new object creation. If you look through Books Online, or set up an alert through Enterprise Manager, you'll find a list of all the events and performance counters that SQL Server can monitor and alert for. If one doesn't exist for object creation then the SQL job idea is still sound. |
 |
|
|
|
|
|