Link to home
Start Free TrialLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

asked on

SQL Server stored proc

I have a stored proc that checks for blocking sql...and when it finds these results it stores it to a table.

I would like to have another stored proc that looks at what is written in that table and executes a command...

So my table that gets populated if there are sql blocks goes into this table called dba_blockinfo.
The query below would make the kill command I need to kill the sql that blocks my server out...of course I could add some additional where clauses later..but what I need to know is how to write this stored proc...so I could execute this kill spid that is created here.

I think If I have this as a stored proc..I already have a place in my logic to place it....or atleast that would be the scope of this question.

  SELECT
      'KILL ' + LTRIM([blocker_sid])
FROM
       [master].[dbo].[dba_blockinfo]
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robb Hill

ASKER

Thanks