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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Lock Trigger!

Author  Topic 

Ali Reza Pooneh
Starting Member

14 Posts

Posted - 2010-04-20 : 08:02:43
Hi.
I have a database on SQL Server 2005 that other connect to it by my application. But some day ago, one trigger created on a table that has a lock icon and I can't to modify it or delete or ...(See picture)
I think another user on LAN access to my database nd server! Also all records that inserted in long time(half a day) are deleted in end of work time and I think this trigger couse it. Please help me to find who created it(log files or log table or ...),how delete it or view trigger code and another info that help me to find resource of this sabotage!
[url]http://drop.io/mysqltrigger/asset/what-s-this-jpg[/url]

Sachin.Nand

2937 Posts

Posted - 2010-04-20 : 09:20:14
What rights do your login has on the database?
Also from the screenshot it seems that you can disable the trigger.

Also try sp_helptext triggername to view the trigger code.

PBUH
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-20 : 09:42:21
i think trigger is encrypted which is why you're having difficulty in viewing it.Are you dbo of this db?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Ali Reza Pooneh
Starting Member

14 Posts

Posted - 2010-04-21 : 02:55:30
Hi again. We found 4 triggers on database by master-tr,server_tr0,server_tr1,... names. When I want to delete them, an error message appear:

Drop failed for DatabaseDdlTrigger 'Server_tr0'. (Microsoft.SqlServer.Smo)
-------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1376.2+((KJ_RTM).091225-2253+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+DatabaseDdlTrigger&LinkId=20476
------
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------

The transaction ended in the trigger. The batch has been aborted. (Microsoft SQL Server, Error: 3609)

---------------------------------------------------------------------------------------------------------------
I think another trigger or... exist and it rollback the delete transaction. How can I see what triggers or sp run when I delete trigger? Notice that View dependencies doesn't work and appear error when I find dependencies objects.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-21 : 03:33:54
There's a DDL trigger in place that prevents those triggers being dropped. Drop or disable that first. You'll find it, in management studio under database->programability-> database triggers

You still won't be able to view the code, it's encrypted.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Ali Reza Pooneh
Starting Member

14 Posts

Posted - 2010-04-21 : 03:50:27
Only 4 trigger exist in database triggers and all of them are encrypted and I can't delete them.
I think these triggers depend on them; for more,when I want to delete one of them, another trigger excute and rollback operation.Is there a way to disable all triggers on server or a database?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-21 : 04:27:31
Encrypted does not mean can't delete. Just that you can't read.

Deleting a database trigger does not fire a DDL trigger (it's a safety precaution so that you can't get locked into a state where you can't drop a broken trigger), so you should be able to delete.
NB, I'm talking about database triggers, not triggers on a table.

There is a syntax to disable. Look in Books Online.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-21 : 05:49:39
see

http://msdn.microsoft.com/en-us/library/ms189748.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -