1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

How to get table structure via SQL?

Discussion in 'SQL - Questions and Answers' started by Nicolas Fournier, Feb 8, 2007.

  1. Dialect: SQL 92
    Hi, I'm currently programming an automatic class builder that will create C# or VB class to controll a SQL Server 2000 data base. I need to be able to select the structure of the table to extract the Column names, types, max length, etc. I've done this while I was in college, but I don't seems to find any clue about it on Inet. Any idea ?

    Select Struct ???
  2. Dimitar Guest

    Dialect: MS SQL
    http://www.simple-talk.com/dotnet/.net-framework/schema-and-metadata-retrieval-using-ado.net/
    Does this help?
  3. Avaneesh Guest

    Dialect: MS SQL
    SQL:

    select table_name,ordinal_position,column_name,data_type,is_nullable,character_maximum_length from
    information_schema.columns where table_name like '%TABLENAME%'
    order by ordinal_position
    AVANEESH
  4. meera Guest

    Dialect: MySQL
    SQL:

    describe ;

    or
    SQL:

    select column_name,column_type,is_nullable,column_key,column_default,extra from information_schema.columns where
    table_schema='' and table_name=''
  5. amar Guest

    Dialect: MS SQL
    SQL:

    sp_help
  6. vishwanath Guest

    In SQL server

    We can use this statement to get the structure of a table

    EXEC sp_help <table_name>
  7. lavanya New Member

    Go to Sql server 2000 and execute " sp_help tablename" i already worked with it.it definitely works.
  8. Unregistered Guest



    Thanks a lot for this...

Share This Page