Comparing Large Files in Excel and SQL Server

Suppose I have 2 large files.  If I want to compare them using a MATCH function in Excel it could take hours.
If I load them into a SQL Database and do an inner join it can take minutes or seconds.

I want to compare some large files in Visual Studio 2010 (C#) and was wondering if I could compare them in minutes rather than hours without actually uploading them to a SQL Database.
AlHal2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Depends on what you're comparing. A database engine line SQL Server is optimized for these sorts of things. A programming language - any language - is not. C# (or any .NET language) has methods you can use to compare data/records, but those will always be slower than a database.

If you want the most performance, then load them into a database table and use Joins and such as you mention. You have a bit less control over the process, but it's easily the fastest.

If you need finer control, then moving this into a datatable (or something along those lines) would give you that. It would be slower, of course.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
You also need to think just what 'compare' actually means.
consider the following two fictional file contents:
file1
A
B
C
D

and file2
A

B
C
D

Note the second has one blank line in it, otherwise identical contents BUT only the first line matches between the two.
0
Pawan KumarDatabase ExpertCommented:
>>.I want to compare some large files in Visual Studio 2010 (C#) and was wondering if I could compare them in minutes rather than hours without actually uploading them to a SQL Database.

Always better to upload the files in SQL ( DATABASE ) and then compare. With this you can compare N number of columns and rows. Any other tool/language will take time. Data Truncate and conversion issues with also occur.
0
AlHal2Author Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.