Get information from tables

  • Comments posted to this topic are about the item Get information from tables

  • Very useful query! I tweaked it for English-US. Hope you don't mind. Thanks for the hard work on this one!

    SELECTTAB.NAME AS [Table Name],

    COL.NAME AS [Column Name],

    TIP.NAME AS [Data Type],

    COL.MAX_LENGTH AS [Column Lenght],

    (CASE WHEN COL.IS_NULLABLE = '0' THEN 'NO' ELSE 'YES' END) AS ColumnNullable, EXT.VALUE AS [Description]

    FROM SYS.TABLES TAB

    INNER JOIN SYS.COLUMNS COL ON TAB.OBJECT_ID = COL.OBJECT_ID

    INNER JOIN SYS.TYPES TIP ON TIP.USER_TYPE_ID = COL.USER_TYPE_ID

    LEFT OUTER JOIN SYS.EXTENDED_PROPERTIES EXT ON EXT.MAJOR_ID = TAB.OBJECT_ID AND COL.COLUMN_ID = EXT.MINOR_ID

    ORDER BY TAB.NAME

    Frederick (Fred) J. Stemp, Jr.
    Database Administrator / Database Developer
    Dealer Funding, LLC

    '...if they take my stapler then I'll set the building on fire...'

  • Thanks for the script.

Viewing 3 posts - 1 through 2 (of 2 total)

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