USAGE
First run this script is the database where you want to store this procedure
Then you can run the stored procedure with the following statement:
EXEC sp_ObjectExplore 'database.schema.tablename'
You do not need to supply databasename and schema (example: dbo) when table is in same database as this procedure.
If you want additional metrics concerning the distribution of all numeric variables, execute with parameter @distribution='yes'.
Example:
EXEC sp_ObjectExplore 'database.schema.tablename'
, @distribution='yes'
If you are only interested in a subset of columns, you can specify them in the parameter @columns
Columnnames must be separated by a comma. You can specify them either with or without brackets []
Columnnames may not contain commas.
Example:
EXEC sp_ObjectExplore 'database.schema.tablename'
, @distribution='yes'
, @columns='column1, column2, etc'
PURPOSE
Provide summary information and metrics for any column in a given Table/View
Metrics included are:
* Total number of records in Object (Records)
* Number of values in column (Cnt)
* Number of unique values in column (CntDist)
* Number of NULL values in column (NullValues)
* Min and Max value in column (Min/Max)
* Average value in column (Avg)
* Standard Deviation in column (StDev)
* Number of numeric values in column (IsNum)
* Number of integer values in column (IsInt)
Optional metrics (only computed if procedure is executed with parameter @distribution='yes'
* First Quartile/25% (Q1)
* Median (Median)
* Third Quartile/75% (Q3)
* Interquartile range (IQR)
* Skew (Skew)
* Kurtosis (Kurt)