GETTABLE DEFINITIONS USING t-sql

  • I need to create a booklet of some of our 84000 tables in MS Sql I would like to be able to use t-sql to get table definitions I need?

  • Pretty broad request, what are you actually try to get back from the sql query?

  • Column Name, field type, length

  • Let me point you toward Books Online (BOL). Take a look at the definitions of sys.tables, sys.columns, sys.types.

  • I USED THIS SELECT AND IT HAD ALL THE INFORMATION I NEEDED

    SELECT *

    FROM INFORMATION_SCHEMA.COLUMNS

    WHERE TABLE_NAME = 'YOUR_TABLE_NAME' ORDER BY COLUMN_NAME

    THANKS

  • twdavis (3/3/2009)


    I USED THIS SELECT AND IT HAD ALL THE INFORMATION I NEEDED

    SELECT *

    FROM INFORMATION_SCHEMA.COLUMNS

    WHERE TABLE_NAME = 'YOUR_TABLE_NAME' ORDER BY COLUMN_NAME

    THANKS

    keep in mind that information_schema "hides" the tables you don't have permissions on... ( 😉 )


    * Noel

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply