Using Statistics | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Using Statistics

I am able to collect and display statistics using sp_createstats and DBCC SHOW_STATISTICS, but I need to use those values for some calculations. Is there any way by which I can query those values to extract them ? or is there any table where those values are stored ?
I believe Statistics stored in view in as blob …
I don’t think you get anything out of it… Check the following article…
http://www.microsoft.com/technet/prodtechnol/sql/2005/qrystats.mspx MohammedU.
Moderator
SQL-Server-Performance.com All postings are provided “AS IS” with no warranties for accuracy.

explain in more detail
you probably will have to use the options below: DBCC SHOW_STATISTICS ( ‘table_name’ | ‘view_name’ , target )
WITH STAT_HEADER | DENSITY_VECTOR | HISTOGRAM basically, run each option, inserting results into a table,
then query it
this is not a cheap option

Hi joechang, for instance i am running DBCC SHOW_STATISTICS(‘Employee’, sample_stat) WITH DENSITY_VECTOR where Employee is my table name and sample_stat is my statistic name (basically the index).
The result of this is displayed in the results window but it gets stored in form of a blob in the sysindexes table and hence i cannot query it. I was keen to know whether there is any method by which i can access the results by querying them (since i dont get anything from the blob entries)

Visit the following link for code samples andhttp://www.microsoft.com/usa/webcasts for the webcasts. If not you can use XML to display the relevant data, as explained there is no easy way. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
]]>