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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Query to rename colunm

Query to rename colunm

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
5 Posts 3 Posters 1 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.
  • X Offline
    X Offline
    xoxoxoxoxoxox
    wrote on last edited by
    #1

    Hello, Is there anyway to append some value to colunm name? For example, i have table with 150 colunms and i want to do Select * and append today's date with each colunm name. So column1, column2... should display colunm1_112006, column2_112006 and so on etc. I'll appreciate any help. Thanks in advance.

    R 1 Reply Last reply
    0
    • X xoxoxoxoxoxox

      Hello, Is there anyway to append some value to colunm name? For example, i have table with 150 colunms and i want to do Select * and append today's date with each colunm name. So column1, column2... should display colunm1_112006, column2_112006 and so on etc. I'll appreciate any help. Thanks in advance.

      R Offline
      R Offline
      Rob Graham
      wrote on last edited by
      #2

      "select column1 as column1_112006,colum2 as column2_112006 from table1"

      X 1 Reply Last reply
      0
      • R Rob Graham

        "select column1 as column1_112006,colum2 as column2_112006 from table1"

        X Offline
        X Offline
        xoxoxoxoxoxox
        wrote on last edited by
        #3

        I don't want to use keyword "as" for 150 columns. Is there any way to rename using "select *" ?

        R 1 Reply Last reply
        0
        • X xoxoxoxoxoxox

          I don't want to use keyword "as" for 150 columns. Is there any way to rename using "select *" ?

          R Offline
          R Offline
          Rob Graham
          wrote on last edited by
          #4

          Nope. You could build your query dynamically in a stored procedure (Use schema to get the column names). 150 column table doesn't sound like a good design...

          P 1 Reply Last reply
          0
          • R Rob Graham

            Nope. You could build your query dynamically in a stored procedure (Use schema to get the column names). 150 column table doesn't sound like a good design...

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            Rob Graham wrote:

            150 column table doesn't sound like a good design...

            :omg::wtf: Normalization could be a good idea :rolleyes:


            Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

            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