views:

138

answers:

3

I've got a trigger in a sql server table. This trigger has disappeared. Is there something systematic that might be causing it to be deleted?

There is no replication on this db.

+2  A: 

Recreating the table can drop a trigger. Disabling triggers is also possible. Might it be one of these options?

Randolph Potter
table was not recreated. trigger was gone, not disabled.
mson
+1  A: 

In addition to what Randolf said, it is possible that some other developer or dba dropped the trigger because it was interfering with what he or she wanted to do. Not everyone understands the ramifications of doing such dumb things so they happen. It would be a good example of the need for more formalized processes and to limit access to production if this is the case.

Hopefully you have the trigger under source control and can easily recreate it.

You might also consider implementing DDL triggers so that you can prevent such things in the future or at least see who did them.

HLGEM
DDL triggers will help me find the culprit!
mson
It won't help find the culprit this time, but will if it happens again.
HLGEM
+1  A: 

2 options if vanished

  • DROP/CREATE TABLE ...
  • DROP TRIGGER ...

An option if not working_

  • ALTER TABLE ... DISABLE TRIGGER ...

You can see if the table was recreated using this. Of course, it does not tell you who...

SELECT create_date, modify_date FROM sys.objects WHERE name = 'MyTable'

For example, a table change via SSMS GUI that went wrong, can drop a trigger. But there is no systematic process to randomly drop a trigger: it requires an explicit action by someone.

gbn
Someone recently purchased the sqlcompare from redgate. I wonder if it is the culprit...
mson
I doubt it: it's a very safe tool compared to SSMS.
gbn