2

I want to extract some information out of the DBCC SHOW_STATISTICS command. So I have been trying to do this with a subquery, but until now it seems to be impossible. Via google, I found some suggestions with a temporary table, but this seems to require to define the temporary table first.

Is there any solution, or can people confirm that this is impossible?

Martao
  • 795
  • 2
  • 6
  • 12
  • 1
    Using a table (temporary or permanent) for DBCC results has [already been asked](http://stackoverflow.com/questions/5946813/how-to-catch-the-output-of-a-dbcc-statement-in-a-temptable) and even the MSDN documentation [shows](http://msdn.microsoft.com/en-us/library/ms188796(v=sql.90).aspx) that approach. Why do you not want to use a table here? – Pondlife Jan 28 '13 at 14:22
  • Sorry, that thread didnt show up in my search. However, I believe it is a bit weird that I would have to define the temptable myself, as the output of the DBCC command is a table. It seems to be I have to "guess" the table definition now, right? Also, I do not need all the information from it. So it would make pretty much sense if I could just select from . That said, I'll try to get the TempTable working... – Martao Jan 28 '13 at 14:59
  • You could try employing `OPENQUERY` like in [this answer](http://stackoverflow.com/questions/1492411/sql-server-select-from-stored-procedure/9401310#9401310 "SQL Server - SELECT FROM stored procedure"). – Andriy M Jan 28 '13 at 17:58

0 Answers0