Comapre two tables in Different Databases!!

  • I have a table in SQL 2005 which I want to compare against a DB2 table. What will be the best way to do this in a VB .net Program? I am currently opening two different connections and trying to read them and compare one by one. but this is very slow and taking a long time..

    Any help is much appreciated...

    Thanks,

    Nikhil

  • Are you comparing the schemas or the data?

  • Like Jack said comparing two different database can be anything.Schema,data or some time change in structure. I assume you might be capturing the difference and reporting the user. If so just do them at the database level (stored procedure ) and get the result out.

  • if you want to compare all the data, I would use SSIS to migrate the entire table to a scratch database in sql server and then use an automated tool such as Data Diff from ApexSQL (which has a command line interface so you can automate it).

    Disclaimer: I have a close relationship with Apex, use their products and recommend them to my clients. Also, if you care to you can mention TheSQLGuru sent you you will get a discount and my daughter will get a few coins for her college fund.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • As Sqlguru suggested SSIS is very handy tool for synchronization. It is very efficient and fast. I have tried it personally.

    (dont know why his daughter needs funding as he is guru for all us!!!)

    ta

  • I've had decent results using MS Access to compare data from different sources. Link tables to each of the databases, then use Access queries to do the comparisons. As long as you have ODBC DSN's defined for each source, it's easy to do.

  • I wanted to do a Data match up between two tables. Think of it just like a VLOOKUP in excel. I will try the Access approach and see what comes up. I can't go for a new Database or temp tables in SQL. There are some resource limitation in our Production environment. :crying:

    Thank you friends for prompt replies

  • Guys,

    I tried the MS-Access approach and it seems that this is not going to work all well. When I run query after designing the Link Tables, the query retruns error "data mismatch in criteria expression" I double checked the columns and it seems that none of the columns need a casting.

    Any suggestion or advise is really welcome.

    Thanks,

    Nikhil

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply