Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 1361 | Views in the last 30 days: 1
 
Related Articles
BLOG

Denali – Day 20: More Programmability Feature

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

FORUM

Sql Server Information

Gathering Server information

FORUM

MMO Bioware Austin Texas - Database Programmer

Database Programmer Video Games

FORUM

SQL 101 for application programmers

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

FORUM

Costum Report - Server Information

Costum Report - Server Information

 
Contribute