generate data dictionary

  • g'morning all -

    I know I can get field names, datatypes, and sizes by having SQL server generate a create table script. I'd like to break it up into a column for each of these. This is probably a pretty basic question, but here was an idea I had (that obviously doesn't work)

    select column_name, type_name,length, is_nullable

    from (sp_columns 'incident_information')

    any other ideas or old standard tricks 🙂

  • Try this

    Select * From Information_Schema.Columns

    or get what you appear to desire using:

    Select Table_Schema,Table_Name,Column_Name,Data_type,Character_Maximum_Length

    From Information_Schema.Columns

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • excellent. Thanks Ron.

    I had looked at information_schema.TABLES, but missed the Information_Schema.Columns.

    here's how I'm going to use it:

    Select TABLE_NAME

    , COLUMN_NAME

    , DATA_TYPE

    , CHARACTER_MAXIMUM_LENGTH

    , IS_NULLABLE

    From Information_Schema.Columns

    order by TABLE_NAME

    Thanks again.

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

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