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

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

Find a Table's Metadata

By Crosbie Christopher,

SQL Server stores all of the metadata information that you would ever need to know about a table. However, it is often cumbersome and nominative for programmers to pull out this data using the system tables and special sprocs that are required to find the useful information. I have worked in multiple enterprises where it became my responsibility for keeping track of basic table/field information in a user table despite the fact that this information is readily available in SQL Server's system tables.

Using this procedure, programmers pass in a table name and schema for a user table and receive tuples of fields that contain the data type, length, description, and the lookup table if there is a foreign key constraint. Our programmers now use this sproc to dynamically generate data entry forms based on the table's metadata without having to understand the nuances of how this data is stored in SQL Server.

Our DBAs also use it to gain a quick glimpse into how a table is designed without using the graphical tools of Management Studio or Enterprise Manager.
The procedure could be tailored to output additional information specific to a program/organization.

Total article views: 1352 | Views in the last 30 days: 2
Related Articles

Denali – Day 20: More Programmability Feature

Denali – Day 20: More Programmability Feature Native XML Web Services (SOAP/HTTP endpoints) is ...


Sql Server Information

Gathering Server information


MMO Bioware Austin Texas - Database Programmer

Database Programmer Video Games


SQL 101 for application programmers

Request for a primer for all those programmers ignorant about db management


Costum Report - Server Information

Costum Report - Server Information


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

Already a member? Jump in:

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