Results of DBCC, sp_... into table

  • Hi all,

    I remember something on this site a year or so ago that instructed how to capture the results of a sproc or DBCC command into a table for analysis.  Haven't used in a while, so naturally the knowledge evaporated.  Any ideas?

    Thanks in advance!

    Carter



    But boss, why must the urgent always take precedence over the important?

  • Here's a little example to get you going...

    create table #who2

     (

     #SPID int NULL,

     #Status varchar(30) NULL,

     #Login sysname NULL,

     #HostName sysname NULL,

     #BlkBy varchar(128) NULL,

     #DBName sysname NULL,

     #Command varchar(128) NULL,

     #CPUTime int NULL,

     #DiskIO int NULL,

     #LastBatch char(14) NULL,

     #ProgramName sysname NULL,

     #SPIDb int NULL)

    insert #who2

     exec sp_who2

    select * from #who2

    drop table #who2

    -- Steve

     

  • You may also be thinking of this? (also needs a premade table to load into like the above example)

    Using DBCC Result Set Outputs

    Many DBCC commands can produce output in tabular form (using the WITH TABLERESULTS option). This information can be loaded into a table for further use.

    eg.

    USE pubs

    INSERT <premadeTable>

    DBCC SHOWCONTIG WITH TABLERESULTS, ALL_INDEXES

    ..and so on..

    /Kenneth

     

     

  • Thanks for the help - that's exactly what I needed!

    Have a great weekend.

    Carter



    But boss, why must the urgent always take precedence over the important?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply