Copy values from col1 to col2 in SAME table

  • Hi,

    I have a table which contains 2 columns

    I want to copy the value in column 1 to column 2.

    Schema:

    tblStore

    Column1 INT (contains the values that I want to copy over)

    Column2 INT NULLABLE (at the moment, this is empty)

    I tried

    <code>

    INSERT INTO tblStore

    (column2)

    VALUES (column1)

    </code>

    I also tried:

    <code>

    INSERT INTO tblStore.column2

    SELECT column1

    FROM tblStore

    </code>

    but no joy either.I am sure that I am on the right lines.Can anyone give me a push?

    Many thanks,

    yogi

  • update tblStore set column2 = column1

  • Do

    UPDATE tblName SET Col2 = Col1

  • Thanks folks, I bet you're glad everyone's not as stupid as me 🙂

    cheers, yogi

  • UPDATE TBLSTORE SET COLOUMN2 = COLOUMN1

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply