Outputting DBCC results

Published 26 July 08 09:29 AM | Madhivanan 

Sometimes it may be useful to reuse the result of the DBCC commands. If the DBCC command resturns a resultset, it can be outputted to a table.

Consider the following command

DBCC useroptions

It returns a single resultset. To copy the resultset to a table, you can use the following

Create table #dbcc_useroptions ([set option] varchar(100), [value] varchar(100))

insert into #dbcc_useroptions
exec('DBCC useroptions')

select * from #dbcc_useroptions

drop table #dbcc_useroptions

Note that it is possible with dynamically executing DBCC commands and only the DBCC commands that returns a resultset can be used

Comments

# Other SQL Server Blogs around the Web said on July 26, 2008 4:58 AM:

Sometimes it may be useful to reuse the result of the DBCC commands. If the DBCC command resturns a resultset

# SQL Server Transact-SQL (SSQA.net) : Outputting DBCC results said on July 26, 2008 5:06 AM:

PingBack from http://sqlserver-qa.net/blogs/t-sql/archive/2008/07/26/4665.aspx

Anonymous comments are disabled