I have lost a trigger. I know it is active, since when I try to change a field, it restores its value back, and from the SQL Server Management Studio I can see that when I execute the query, an extra one is executing (the trigger one).
I tried SELECT * FROM sys.triggers WHERE 1 = 1 but it does not return anything. Also, I know the name of the trigger, but when I try to ALTERit returns an error saying that
the name of the object ‘myTrigger’ is not valid.
And if I try to DROP TRIGGER myTrigger ON DATABASE
Trigger ‘myTrigger’ can not be removed because it does not exists, or the user has not enough priviledges.
Ok, as Lieven said, I was not querying the right database… This is odd, since the query had the DB defined on it
But the upper select of the SQL Server Management Studio was pointing to other DB…
Edit:
I have been investigating a little bit (trying to clean my image), and I found a weird behaviour on SQL Server Management Studio.
If you execute a query like:
It executes the query in the right DB. No matter what DB is pointed by the upper select.
But, if you try to do the same, with a trigger, you must have the upper select pointing the right DB, or you will face the same problems I had.