Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    2

    Unanswered: DBCC InputBuffer statement to be part of a select statement

    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??

  2. #2
    Join Date
    Jul 2002
    Location
    Silverton, Oregon
    Posts
    5
    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 ).

  3. #3
    Join Date
    Jul 2002
    Location
    Silverton, Oregon
    Posts
    5
    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 ).

  4. #4
    Join Date
    Jul 2002
    Posts
    2
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •