Skip to content

timothy-dean/sp_GetColumnMetadataStats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

sp_GetColumnMetadataStats

SQL Server Stored Procedure to get table or view column metadata and statistics

USE [DBA]
GO

DECLARE @RC int
      , @DatabaseName sysname
      , @SchemaName sysname
      , @TableName sysname
      , @IncludeStats bit
      , @IncludeTopValues bit
      , @Debug bit

SET @DatabaseName = N'AdventureWorksDW2019';
SET @SchemaName = N'dbo';
SET @TableName = N'DimProduct';
SET @IncludeStats = 0;
SET @IncludeTopValues = 0;

EXECUTE @RC = [dbo].[sp_GetColumnMetadataStats] 
   @DatabaseName
  ,@SchemaName
  ,@TableName
  ,@IncludeStats
  ,@IncludeTopValues
  ,@Debug
GO

image

IncludeStats

Setting this flag add the following additional statistics columns to the output

count_distinct count_empty count_null count_row val_min val_max len_max

image

IncludeTopValues

This flag adds top 10 values for each column ordered in descending order, with the count shown in parenthesis after each item.

The @IncludeStats flag must also be set.

image

About

SQL Server Stored Procedure to get table or view column metadata and statistics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages