Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Extract column name of a table

Extract column name of a table

Scheduled Pinned Locked Moved Database
databasetutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bony_baba
    wrote on last edited by
    #1

    hi how to extract column names of a perticular table can anyone tell me the query for that Thanks Thanks

    C 1 Reply Last reply
    0
    • B bony_baba

      hi how to extract column names of a perticular table can anyone tell me the query for that Thanks Thanks

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Assuming SQL Server (because you don't say what database you are using)

      SELECT * FROM INFORMATION_SCHEMA.COLUMNS
      WHERE TABLE_NAME = 'NameOfTheTableHere'


      Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      B V 2 Replies Last reply
      0
      • C Colin Angus Mackay

        Assuming SQL Server (because you don't say what database you are using)

        SELECT * FROM INFORMATION_SCHEMA.COLUMNS
        WHERE TABLE_NAME = 'NameOfTheTableHere'


        Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

        B Offline
        B Offline
        bony_baba
        wrote on last edited by
        #3

        Thanks for help but its not working i dont know whats the proble Actually i am using ms access database where GeometryData.mdb is my database name and iges_data is my table name Please help me Thanks

        1 Reply Last reply
        0
        • C Colin Angus Mackay

          Assuming SQL Server (because you don't say what database you are using)

          SELECT * FROM INFORMATION_SCHEMA.COLUMNS
          WHERE TABLE_NAME = 'NameOfTheTableHere'


          Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

          V Offline
          V Offline
          vivek g
          wrote on last edited by
          #4

          hello, try out .. one of these.. 1. sp_columns tablename 2. select name from syscolumns where id = object_id('tablename') vivek

          C 1 Reply Last reply
          0
          • V vivek g

            hello, try out .. one of these.. 1. sp_columns tablename 2. select name from syscolumns where id = object_id('tablename') vivek

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            Why are you telling me this? You should be telling the OP. Also, since he eventually admitted to using access these won't work in his situation because they are SQL Server specific.


            Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups