I want to use DBCC inputbuffer function for all the spids in sysprocesses table without using a cursor or loop. In other words, I want to have the value of dbcc inputbuffer part of the select statement directly or indirectly. Is there a way??SQLDBAxxx,
Try running the following:
----------
set nocount on
select 'exec DBCC INPUTBUFFER('+convert(varchar,spid)+')'
from sysprocesses
go
----------
This will generate the DBCC code you need to run; it won't run
DBCC in the TSQL mode that you need. You can save the result set
and reload it to run it. Simple, but works...
I've never been able to execute a DBCC statement using ANSI-SQL syntax( select,update, insert ).|||SQLDBAxxx,
Try running the following:
----------
set nocount on
select 'DBCC INPUTBUFFER('+convert(varchar,spid)+')'
from sysprocesses
go
----------
This will generate the DBCC code you need to run; it won't run
DBCC in the TSQL mode that you need. You can save the result set
and reload it to run it. Simple, but works...
I've never been able to execute a DBCC statement using ANSI-SQL syntax( select,update, insert ).|||Thank you Scooter. But this is not what I wanted to do. I want to capture the input buffer for a given spid. I can do it thro a cursor or loop but if my recordset is big then by the time it comes to execute the dbcc inputbuffer for the last spid the inputbuffer may have changed. That is the reason I wanted to try by some other way to narrow down the time difference.
No comments:
Post a Comment