Reputation: 27
I need some help for transfering data from one table to another.
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 ?
Upvotes: 0
Views: 854
Reputation: 1322
here is your code..
truncate table Contrinex.GPOQA.dbo.PrinterSet
go
insert into Contrinex.GPOQA.dbo.PrinterSet
select * from Contrinex.GPO.dbo.PrinterSet
Upvotes: 2
Reputation: 350
You can use Sql Server Export functianality, where you can transfer data from one table to another across Database.
Please refer the below link on using the SQL Server Export
http://searchsqlserver.techtarget.com/feature/The-SQL-Server-Import-and-Export-Wizard-how-to-guide
Upvotes: 0
Reputation: 9
select data from first database table and insert it into the second database table as
INSERT INTO GPOQA.PrinterSet SELECT * from GPO.PrinterSet
if want some perticular columns then set column names as
INSERT INTO GPOQA.PrinterSet a SET a.column1=b.column1,.... SELECT column1,... from GPO.PrinterSet b
Upvotes: 0
Reputation: 122002
TRUNCATE TABLE [Contrinex.GPOQA].dbo.PinterSet
GO
INSERT INTO [Contrinex.GPOQA].dbo.PinterSet (...)
SELECT ...
FROM [Contrinex.GPO].dbo.PinterSet
Upvotes: 1