about number of columns in a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhmadhukar
    New Member
    • Mar 2008
    • 4

    #1

    about number of columns in a table

    hai friends,

    i created a table with a name 'emp'. And it has 4 columns. Now my question is,
    tell me a query, procedure or what ever available, how to get the number of columns from a table.

    thanx in advance.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by bhmadhukar
    hai friends,

    i created a table with a name 'emp'. And it has 4 columns. Now my question is,
    tell me a query, procedure or what ever available, how to get the number of columns from a table.

    thanx in advance.
    try:

    Code:
    select count(*) from syscolumns where id in (select id from sysobjects where name = 'YourTableName')
    -- CK

    Comment

    Working...