Data Comparison

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Madhivanan

    Data Comparison

    I have an Employee table with 3000 records and an Excel file having the
    modified data of those emplyoees. Some of the data of Excel may be same
    as that of table data but some may differ. EmpId is the unique field.
    Other than this field, other fields of Excel may have modified data.I
    need to compare the data from SQL Server table with Excel Data.
    I decided to write a VB Program having two recordsets,one for SQL
    Server and other for Excel and compare each field's value. If the
    modified value is found then update that to table. Is there any way to
    compare in SQL Server itself?

    Madhivanan

  • Simon Hayes

    #2
    Re: Data Comparison

    Probably the easiest way is to create a second Employee table with the
    same (or similar) structure as the current one. You can load the new
    data into it with DTS or bcp.exe, and it's then easy to compare
    whatever you want with SQL queries. This is quite a common general
    technique for importing data - load into a staging table, check/clean
    the data, then INSERT/UPDATE the destination table.

    There are other options too, such as creating a linked server pointing
    at the .xls file, but I would say that loading the data is probably the
    simplest.

    Simon

    Comment

    • Madhivanan

      #3
      Re: Data Comparison

      Yes, I already decided to create new table with same structure and
      export Excel to SQL Server table. Thanks

      Madhivanan

      Comment

      Working...