Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Trigger for lock event.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

67 Posts

Posted - 04/17/2004 :  03:57:32  Show Profile  Reply with Quote

Is it possible to create a trigger on the event of block/Lock if the status "Sleeping" and wait type is "Awaiting Command" ?

So that it automativally kill the session when it detects lock contention.


United Kingdom
12543 Posts

Posted - 04/17/2004 :  19:07:38  Show Profile  Visit nr's Homepage  Reply with Quote
Not a trigger but you can write an sp and schedule it to run frequently.
You probably wouldn't want to kill this sort of process immediately anyway.

Another option would be to use the profiler to log the events to a table and put trigger on the table.

Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Yak Posting Veteran

67 Posts

Posted - 04/20/2004 :  05:00:43  Show Profile  Reply with Quote
Nice idea.
Go to Top of Page

Pointy Haired Yak DBA

4184 Posts

Posted - 04/20/2004 :  08:02:20  Show Profile  Visit derrickleggett's Homepage  Send derrickleggett an AOL message  Send derrickleggett a Yahoo! Message  Reply with Quote
If you're getting to the point where locks are this bad, you should probably look at using WITH(NOLOCK) strategically and a possible redesign on your tables. Have you thought about that? You can find the contention areas by using Profiler like Nigel suggested.


When life gives you a lemon, fire the DBA.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000