Below are the field names and datatypes of each of the result sets as reported by SQL Server (I tested on SQL Server 2012, 2014, and 2016, though I would expect these to remain consistent across SQL Server versions):
DBCC SHOW_STATISTICS() WITH STAT_HEADER
[Name] NVARCHAR(128)
[Updated] NVARCHAR(20)
[Rows] BIGINT
[Rows Sampled] BIGINT
[Steps] SMALLINT
[Density] REAL
[Average key length] REAL
[String Index] NCHAR(3)
[Filter Expression] NVARCHAR(MAX)
[Unfiltered Rows] BIGINT
DBCC SHOW_STATISTICS() WITH DENSITY_VECTOR
[All density] REAL
[Average Length] REAL
[Columns] NVARCHAR(4000)
DBCC SHOW_STATISTICS() WITH HISTOGRAM
[RANGE_HI_KEY] INT -- Datatype varies based on datatype of first key column
[RANGE_ROWS] REAL
[EQ_ROWS] REAL
[DISTINCT_RANGE_ROWS] BIGINT
[AVG_RANGE_ROWS] REAL
To be clear, these datatypes are the result set datatypes from the DBCC
commands; there is no indication of the actual datatypes used to store that info. However, it seems reasonable to assume that the datatypes of the result set are the same as those used the store the info.
Also, for anyone curious as to how I was able to determine these datatypes: I got the info from a SQLCLR stored procedure I created as part of the SQL# library. It is called DB_DescribeResultSets and is similar to sys.dm_exec_describe_first_result_set but handles multiple result sets, temp tables, dynamic SQL, etc (because it runs the query instead of just parsing it). The DB_DescribeResultSets stored procedure is not available in the Free version, though. However, you could do the same thing in any .NET app. It just requires running a query through a SqlDataReader
and then using the GetSchemaTable method to get the result set schema.
I ran DB_DescribeResultSets as follows:
EXEC SQL#.DB_DescribeResultSets
@TheQuery = N'DBCC SHOW_STATISTICS(N''msdb.dbo.sysjobs'',
nc1);',
@RowNumberToGetValuesFrom = 1,
@ResultSetNumberToDescribe = 0, -- 0 = all result sets
@ShowHiddenFields = 1,
@ResultSet = ''; -- this is an XML OUTPUT param and can't have a default in SQLCLR