replace into or insert into, I'm doing something wrong ?

Discussion in 'Databases' started by Marty_, Nov 12, 2007.

  1. #1
    Hi all

    I'm trying to copy data from a table column into another table column

    I've tried the following, however when I try to copy a different column, its adding data into the first column :

    example :
    REPLACE INTO TableA (ColumnA) SELECT (ColumnA) FROM TableB
    Code (markup):
    Then :
    REPLACE INTO TableA (ColumnB) SELECT (ColumnB) FROM TableB
    Code (markup):
    Adds data to TableA ColumnB but it does'nt replace data its adding rows(data) only one row as well, where am I going wrong ?
     
    Marty_, Nov 12, 2007 IP
  2. drunnells

    drunnells Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is TableA ColumnB a Primary Key or Unique? If not REPLACE INTO will insert instead of replace.
     
    drunnells, Nov 13, 2007 IP