954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Moving 2000 rows from Oracle to SQL Server

Hello Friends,

I am new to .NET and to this forum too.
I need to move approx 2K rows from an oracle to SQL server table every week. I am planning to develop a C# console application to achieve this.

Any ideas how to start and what is the best approach with in C# to complete the task at hand? Any code sample will be helpful as I am very new to .NET framework.

Thanks,
Aaron

aaron385
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Do you already have create database in Sql Server? Which sql server will you be using exactly?

Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474
 

SqlBulkCopy is probably the fastest (and fairly easy) method to use.

Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 
Do you already have create database in Sql Server? Which sql server will you be using exactly?

We have SQL 2005 (09.00.0427). The table (and data) already exists in Oracle.
I have created a similar table in SQL server. (Same column names and types)
The .Net app will be scheduled using windows scheduler and is expected to move data from oracle to sql server at scheduled time every week.
I was suggested to use the DataTable to get data from oracle and then insert into sql but as I said I am new to .NET and want to find out what is the best approach.

aaron385
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 
SqlBulkCopy is probably the fastest (and fairly easy) method to use.


Bulkcopy looks interesting. Can I get the data from Oracle and copy to Sql using this method?

aaron385
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 
Bulkcopy looks interesting. Can I get the data from Oracle and copy to Sql using this method?


As long as the data can be placed in a DataTable (which pretty much means any data at all) you can use SqlBulkCopy.

Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 
As long as the data can be placed in a DataTable (which pretty much means any data at all) you can use SqlBulkCopy.

It worked very well. Thanks a lot for your help.

aaron385
Newbie Poster
4 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Please mark this solved then :)

Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: