• subscribe
November 20, 2001 12:00 AM

Generating Descriptions for All Tables in a Database

SQL Server Pro
InstantDoc ID #22993
Downloads
22993.zip

I enjoyed Joe Bishop's tip "Generating a Table Description" (November 2000). Bishop provided examples of code he uses to quickly reference SQL Server 6.5 table structures such as column names, data types, field lengths, and null status of fields. Listing 4 shows how I used a T-SQL cursor to modify Bishop's stored procedure so that the procedure returns a description of all user-defined tables in a particular database. The expression type = 'U' returns entries that refer to user-defined tables. The expression type = 'S' returns entries that refer to system tables. The combination of both expressions returns entries that refer to all tables in the database. Listing 4 shows that I've expanded the WHERE clause by adding the expression OR type = 'S'. If you encounter isolated situations for which you want to return only information about user-defined tables, you can insert a double-hyphen (—), which signals a comment line, in front of the type = 'S' instruction.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...