Solved

Using SSIS to move (not copy!) between to SQL Server instances

Posted on 2010-11-12
6
628 Views
Last Modified: 2012-05-10
Hello,

Is it possible to use SSIS 2005 to move (not copy!) data  between to SQL Server instances?

I am considering to use this technique to archive some large tables from my OLTP DB.

Note: the transfer should be transactional.

Thanks,

PK
0
Comment
Question by:dgb
6 Comments
 
LVL 9

Expert Comment

by:radcaesar
Comment Utility
Copy the data and then truncate the source table in the next step if the copy was successful.
0
 

Author Comment

by:dgb
Comment Utility
radcaesar,

I don't want to move all the data in the table, only a part of it. A T-SQL should decide which rows should be moved.

By the way what if the copy was only partly successful? Will a rollback take place?
0
 
LVL 15

Expert Comment

by:AmmarR
Comment Utility
Dear dgb:

There is no command in SQL server that will move Data from a table to the other

what radcaesar: suggested is right

you need to copy the data you want e.g

Insert into DestTable
Select * from sourcetable
where a = ? --what ever condition

then
do th following

Delete from sourcetable where a = ?

this will in other words move.
-------

and by the way this is the move concept even in windows
its a copy and then delete of source..

0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 6

Expert Comment

by:subhashpunia
Comment Utility
You can move data from one SQL server to another by two methods:
1. Using four part naming. It would require linked server.
2. SSIS pkag.

As for simple SQL to SQL data tranfer, no ssis specific feature is used so I would prefer to use four part naming method to avoid unnecessary deployment, debugging complexity of SSIS.  
0
 
LVL 7

Accepted Solution

by:
Cboudroz earned 500 total points
Comment Utility
To have transactional operation in SSIS you can used Container to put many task and put the TransactionOption property of the container to "Required".

used this to move the row :

DELETE dbo.LiveTable
OUTPUT DELETED.*
INTO LINKSERVER.DATABASE.dbo.ArchivesTable
FROM dbo.LiveTable WITH (TABLOCKX)



everything is explain there:
http://www.mssqltips.com/tip.asp?tip=1585
0
 

Author Closing Comment

by:dgb
Comment Utility
Exactly what I was looking for.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now