Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Object Explore

By Robin van Schaik,

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)

Total article views: 1023 | Views in the last 30 days: 3
 
Related Articles
FORUM

NUMA metric strangeness

Observing strange Perfmon metrics related to NUMA

ARTICLE

Tracking Business Metrics

There can be more to managing a SQL Server instance than just examining the performance metrics. The...

ARTICLE

Guest editorial: SQL Code Metrics

In which Phil Factor toys with the thought of producing quality metrics for SQL code, before dismiss...

FORUM

Stored Procedure to get column metrics

Hi everyone, I have a quick question to write a stored procedure to get column metrics. The stored p...

FORUM

Calculating metric distributions

Hi there, Does anyone have any useful code that I can use to show distributions of data ? Here's ...

Tags
columns    
data exploration    
kurtosis    
metadata    
metrics    
quartiles    
range    
skew    
standard deviation    
statistics    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones