Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010
    Posts
    2

    Unanswered: Fetching column names

    Hi guys,

    Sorry if it is an already-answered post, but I've searched and never found it.
    My question is: Is there a way of fetching column names of a specific table instead of their actual values?

    For example:
    Table A has 3 Columns: Column_Ex_No, Column_Ex_OK1, Column_Ex_OK2
    Each column has their respective values, of course, but they don't matter to me.

    I wanna know if there is a way of fetching only Column_Ex_OK1, Column_Ex_OK2 as VALUES from Table A, for instance.

    Thank you in advance.

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Try something like:
    Code:
    select c.name
    from   sysobjects o, syscolumns c
    where  o.type = "U"
           and o.name = "TableA"
           and c.id = o.id

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Thanks a lot! It works perfectly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •