Showing posts with label tracestatusexec. Show all posts
Showing posts with label tracestatusexec. Show all posts

Thursday, March 29, 2012

export DBCC CHECKDB into table

Is there anyway to export DBCC CHECKDB results into a table?
The only example I was able to find on Books Online is:
INSERT INTO #tracestatus
EXEC ('DBCC TRACESTATUS (-1) WITH NO_INFOMSGS')
Please helpBelow work fine on 2005:
CREATE TABLE a
(c1 int, c2 int, c3 int, c4 varchar(4000), c5 int, c6 int, c7 int, c8 int, c
9 int, c10 int, c11 int,
c12 int, c23 int, c14 int, c15 int, c16 int, c17 int, c18 int)
insert into a
EXEC('DBCC CHECKDB(pubs) WITH TABLERESULTS')
SELECT * FROM a
Of course, create the table with a bit more care and try to match the data t
ypes carefully instead
of just guessing like I did. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Leon Shargorodsky" <LeonShargorodsky@.discussions.microsoft.com> wrote in me
ssage
news:D82B695F-110A-492B-82C6-33C592981F8F@.microsoft.com...
> Is there anyway to export DBCC CHECKDB results into a table?
> The only example I was able to find on Books Online is:
> INSERT INTO #tracestatus
> EXEC ('DBCC TRACESTATUS (-1) WITH NO_INFOMSGS')
> Please help|||It works!
Thanks a million, Tibor!
"Tibor Karaszi" wrote:

> Below work fine on 2005:
> CREATE TABLE a
> (c1 int, c2 int, c3 int, c4 varchar(4000), c5 int, c6 int, c7 int, c8 int,
c9 int, c10 int, c11 int,
> c12 int, c23 int, c14 int, c15 int, c16 int, c17 int, c18 int)
> insert into a
> EXEC('DBCC CHECKDB(pubs) WITH TABLERESULTS')
> SELECT * FROM a
>
> Of course, create the table with a bit more care and try to match the data
types carefully instead
> of just guessing like I did. :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Leon Shargorodsky" <LeonShargorodsky@.discussions.microsoft.com> wrote in
message
> news:D82B695F-110A-492B-82C6-33C592981F8F@.microsoft.com...
>