Forum Discussion

parvez_shaikh19's avatar
parvez_shaikh19
New Contributor
6 years ago

SQL Server Insert and Update

Hello All,

We are developing a solution in which the data from an excel sheet is required to be inserted in the SQL Server. This excel may contain updates for previously inserted rows and may contain net new rows to be inserted, which can be determined by the unique id present in the excel.

Could you please let me know if you have a solution to identify update vs insert in the data from Excel.

Thanks in Advance

1 Reply

  • petar_rajchinos's avatar
    petar_rajchinos
    New Contributor III

    Hi parvez.shaikh19,

    If there is a unique key in the excel and the SQL server table the easiest way to detect changes is using Diff snap (https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438546/Diff). If that doesn’t help than you need to manually create logic for getting the rows from the excel and searching the row in the table. In order to make the search easier and faster you can hash each row (Digest.md5(col1+col2)) from the excel and do the same thing with the table rows and compare hashes instead of columns.

    Regards,
    Petar