Is there a way to save result of A DBCC to a table.

  • Hello,

    How can we move DBCC result to a table for later analysis?

    If I were to move the content of DBCC SHOWCONTIG to a table for later analysis?

    The command INSERT INTO A table

    DBCC SHOWCONTIG does not work?

    Any idea?

    Tha nks

  • You can insert, but only the DBCCs that return a single result set. Some return multiple result sets, some just return messages.

    For ShowContig this should work

    Insert into ....

    EXEC('DBCC ShowContig (''HumanResources.Employee'') WITH TABLERESULTS')

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks

  • You can use the optional "with tableresults" in the DBCC command.

    Here is an example:

    create table [#waitstats]

    (

    [wait type] varchar(80) not null,

    [requests] bigint not null,

    [wait time] numeric(20, 5) not null,

    [signal wait time] numeric(20, 5) not null,

    [now] datetime not null default getdate()

    )

    insert into [#waitstats]([wait type], [requests], [wait time], [signal wait time])

    exec ('dbcc sqlperf(waitstats) with tableresults, no_infomsgs')

  • Thanks for the info. Can you please tell me where can I find out more about

    DBCC SQLPERF(WAITSTATS) . I was not able to obtain any information in term of undersdanding what does this command exactly accomplishe.

    Thanks much

  • Farhad,

    Refer the below link . u'll get some information abt ....

    http://www.sqldev.net/articles/dbcc_sqlperf_waitstats.htm

Viewing 6 posts - 1 through 5 (of 5 total)

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