SQL Server Performance

Copy data from one table to another table

Discussion in 'Getting Started' started by Lionel2007, Nov 1, 2007.

  1. Lionel2007 New Member

    I have two table in the same database. They don't have the exact same column. Can I copy from one table to another table in the same database.
  2. Adriaan New Member

    The basic syntax is
    INSERT INTO Table2 (Col1, Col2)
    SELECT ColA, ColB
    FROM Table1

    If the data types are not identical, you may need to use CAST() around the columns in the SELECT part. Lookup CAST in Books Online for the complete details.
  3. satya Moderator

    DTS can be helpful too for a one-off or as on ongoing job.

Share This Page