System function or DMV to show column information

  • Is there a way to run a system function or look at a dmv which will display information about columns in a table? What system functions or system catalogs will show the best information on columns in a table?

    I am looking to run a query which shows the number of columns in a specific table in a database.

  • I would recommend you take a look at some of the information_schema views. Specifically:

    select * from information_schema.tables

    select * from information_schema.columns

  • also exec sp_help [tablename] provides a lot of nice information, when you need one specific table's info.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Awesome. Thanks for they quick reply!:-D

  • Lowell (3/29/2011)


    also exec sp_help [tablename] provides a lot of nice information, when you need one specific table's info.

    nivek-224024 (3/29/2011)


    I would recommend you take a look at some of the information_schema views. Specifically:

    select * from information_schema.tables

    select * from information_schema.columns

    I like it! Appreciate the assistance. Both are useful.

Viewing 5 posts - 1 through 4 (of 4 total)

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