Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS 2008 Package design


SSIS 2008 Package design

Author
Message
sam 55243
sam 55243
SSC-Enthusiastic
SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)SSC-Enthusiastic (110 reputation)

Group: General Forum Members
Points: 110 Visits: 908
Hi All,

I have a requirement where i need to copy around 70 tables from oracle database to Sql server 2008 and further this total no of tables may increase to 300.

I thought of implementing it dynamically using ADO.NET in script task,instead of having 70 data flow tasks. As a proof of concept i have developed a package where i'm copying data from one sql server to another table in different database. Below is the code for the same. I have taken source and destination for sql server for this POC.

public void Main()
{
// TODO: Add your code here
Dts.TaskResult = (int)ScriptResults.Success;

string Src_connectionString =@"Data Source=XXX;Initial Catalog=Test;Integrated Security=True";
string Dst_connectionString = @"Data Source=XXX;Initial Catalog=Movies;Integrated Security=True";


using (SqlConnection sourceConnection =
new SqlConnection(Src_connectionString))
{
SqlCommand myCommand =
new SqlCommand("SELECT * FROM Customers_1", sourceConnection);
sourceConnection.Open();
IDataReader reader = myCommand.ExecuteReader();

using (SqlConnection destinationConnection =
new SqlConnection(Dst_connectionString))
{
destinationConnection.Open();

using (SqlBulkCopy bulkCopy =
new SqlBulkCopy(destinationConnection.ConnectionString))
{
bulkCopy.BatchSize = 500;
bulkCopy.DestinationTableName = "Customers_Dest";
bulkCopy.WriteToServer(reader);
}
}

reader.Close();

}
}



Here i'm handling 1 source table and both source and target are having same table structure, going forward i'll have a control table where i'll store all 70 table names and there source connection and queries and also its corresponding destination table

Please suggest/advice to go with this design or is there any alternative approach to handle the requirement.

Thanks,
Sam
Pankaj067
Pankaj067
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 68
Hello sam 55243,

Instead of writing code for this problem, I advice you to use SSMA (SQL Server Migration Assistant)

This is a free tool provided by Microsoft for Migration purpose from various database servers to MS SQL Server

You can find much information on this link

http://blogs.msdn.com/b/ssma/archive/2012/01/31/microsoft-sql-server-migration-assistant-ssma-5-2-is-now-available.aspx

Hope this will be helpful to you

Thanks.....:-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search