← Articles
MSSQLTips.com · September 29, 2023

SQL Script for SQL Server Table and Column Properties

This article develops a reusable T-SQL script for profiling SQL Server database tables and columns. It combines system metadata with dynamically generated queries to collect information about column definitions, keys, indexes, partitions, row counts, storage, missing values and observed string lengths.

The script also checks whether certain values suggest alternative temporal data types or contain unexpected dates. Results are consolidated into a global temporary statistics table for further analysis. The resulting database profile helps identify potential design and data quality concerns and provides a foundation for reporting and more targeted investigation.

Visit original source ↗

Search website

Type to search the portfolio.

↑ ↓ Navigate · Enter to open · Esc to close