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. Swap column Names

Swap column Names

Scheduled Pinned Locked Moved Database
6 Posts 5 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.
  • N Offline
    N Offline
    NET India
    wrote on last edited by
    #1

    Hello Friends, I've two columns i.e Name and Address Now i want to swap the column names i mean Name to be Address and Address to be Name

    J I L A 4 Replies Last reply
    0
    • N NET India

      Hello Friends, I've two columns i.e Name and Address Now i want to swap the column names i mean Name to be Address and Address to be Name

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      And the question is...?

      My advice is free, and you may get what you paid for.

      1 Reply Last reply
      0
      • N NET India

        Hello Friends, I've two columns i.e Name and Address Now i want to swap the column names i mean Name to be Address and Address to be Name

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #3

        Just go to your table and Rename the table fields in Design View , if you want to do it script then you can click on Generate Change Script and it will Create Script for your

        Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

        1 Reply Last reply
        0
        • N NET India

          Hello Friends, I've two columns i.e Name and Address Now i want to swap the column names i mean Name to be Address and Address to be Name

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          As the others said, plus you may want to use a third and temporary name to avoid a "Field name already used" error (like when swapping two variables). :)

          Luc Pattyn


          Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


          Local announcement (Antwerp region): Lange Wapper? Neen!


          I 1 Reply Last reply
          0
          • L Luc Pattyn

            As the others said, plus you may want to use a third and temporary name to avoid a "Field name already used" error (like when swapping two variables). :)

            Luc Pattyn


            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


            Local announcement (Antwerp region): Lange Wapper? Neen!


            I Offline
            I Offline
            i i i
            wrote on last edited by
            #5

            Yes :)

            Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

            1 Reply Last reply
            0
            • N NET India

              Hello Friends, I've two columns i.e Name and Address Now i want to swap the column names i mean Name to be Address and Address to be Name

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              how about

              select Name as Address, Address as Name from table

              Just create a view on it and start working .. :) :)

              Abhishek Sur


              My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

              **Don't forget to click "Good Answer" if you like to.

              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