Chris Michalczuk
asked on
SSIS insert / update question from one server table to a table on another server
I want to select some fields from a table on one server and automatically create them in another table on another server
so SSIS package needs to do following
select field1, field2 from server1.table1
delete from server2.table2
insert into server2.table2
values field1, field2
from server1.table1
what's the code / steps for doing this? I'm a bit lost! was thinking of a package in SSIS but is this more a stored procedure?
so SSIS package needs to do following
select field1, field2 from server1.table1
delete from server2.table2
insert into server2.table2
values field1, field2
from server1.table1
what's the code / steps for doing this? I'm a bit lost! was thinking of a package in SSIS but is this more a stored procedure?
You want to do it only once or in a regular way?
For a regular way and with schedules, then using SSIS will be a solution.
For one shoot only you can use Database Import/Export Wizard or T-SQL as:
For a regular way and with schedules, then using SSIS will be a solution.
For one shoot only you can use Database Import/Export Wizard or T-SQL as:
INSERT INTO server2.table2
SELECT field1, field2 FROM
OPENROWSET('SQLNCLI',
'Server='server1';Trusted_Connection=yes;
'SELECT field1, field2 FROM databasename1.table1 )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
After that, create an OLEDB destination, select the database you need to copy the information in. Either select an allready created database (if you have one) or ask it to create a new table for you.
Problem with this setup is that if you run the SSIS package it will add the information from your source to your destination and will add all records (not delete the old ones).
What i do now is just delete the information from the database. To do this you add an SQL execute statement task and type in delete from <destination_database>, then go to the data transormation task in which you tell it to copy info from source to destionation.