Solved

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

Posted on 2010-11-12
6
629 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
ID: 34118579
Copy the data and then truncate the source table in the next step if the copy was successful.
0
 

Author Comment

by:dgb
ID: 34118604
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
ID: 34118777
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 6

Expert Comment

by:subhashpunia
ID: 34119204
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
ID: 34141625
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
ID: 34280906
Exactly what I was looking for.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

911 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

20 Experts available now in Live!

Get 1:1 Help Now