SQL query to return column names

  • Hi there,

    Is there an SQL query which retrieves the column names of a table?

    Ex: For table Emp, there are cols -- Eno,EName,ESalary.

    So, is there a query which I can run on the table Emp so as to retrieve the column names of this table as Eno,EName,ESalary.

    Any inputs are welcome. Thanks in advance

  • Example: (change table name from 'Title' to whatever you want)

    select sc.name

    from sysobjects so

    inner join syscolumns sc on sc.id=so.id

    where so.type='U' and so.name = 'Title'

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

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