Search code examples
sql-serverdatabaseoverwritetransfer

How can I transfer data from one table to another, overwriting old data?


I need some help for transfering data from one table to another.

enter image description here

As you can see there are 2 databases.

I would like to transfer the table datas "PinterSet" located in the database Contrinex.GPO in the table "PrinterSet" located in the database Contrinex.GPOQA.

There are already datas in the table "PrinterSet" of Contrinex.GPOQA but I would overwrite and put the datas from "PrinterSet" of Contrinex.GPO.

So how can I do that ?


Solution

  • here is your code..

    truncate table Contrinex.GPOQA.dbo.PrinterSet
    go
    insert into Contrinex.GPOQA.dbo.PrinterSet
    select * from Contrinex.GPO.dbo.PrinterSet