Move data from one table to another using sql

  • Hi,

    I am having two tables that table name Test1 & Test2. Two tables are same and Test2 is the backup table for Test1. Now i need to do some checking in Test1. So i need to move all the data from table Test1 to Test2. Could you please give the suggestion and how write the query for this task?

    Note : I have already created the table name and column name for Test2 as Test1. Test2 have the existing data also. So i need to update from Test1

    Thanks

    Guvera

  • Hi,

    Insert into Table2(Column1, column2,column3...)

    Select (Column1, Column2, Column3, ...)

    From Table1.

    If they are in different databases then use as <DatabaseName.dbo.TableName>

  • Guvera (5/2/2012)


    Hi,

    I am having two tables that table name Test1 & Test2. Two tables are same and Test2 is the backup table for Test1. Now i need to do some checking in Test1. So i need to move all the data from table Test1 to Test2. Could you please give the suggestion and how write the query for this task?

    Note : I have already created the table name and column name for Test2 as Test1. Test2 have the existing data also. So i need to update from Test1

    Thanks

    Guvera

    From what I understand, you are looking to MERGE THE TWO TABLES

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • Thanks. Its working fine now.

  • Guvera (5/2/2012)


    Thanks. Its working fine now.

    What made it work??

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

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

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