'Checking if a group of data exist in the sql server database
I was asked to do copy of a csv file(which resides on a server and is updated everyday) into the database but a group of 5-6 field are the parameter which will decide whether we can enter the data or not. The condition for insertion is that if it is a completely new entry then it will be entered if it is a copy then skip that row and if it is a different entry then update the entry in the database.
Can someone help me with how can I do this? can I do if exist query but that will be a costly operation as it has to match every record? Or any SSIS activity might help with this?
Solution 1:[1]
you can make form this query MERGE and when matched do nothing https://www.mssqltips.com/sqlservertip/1704/using-merge-in-sql-server-to-insert-update-and-delete-at-the-same-time/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kucluk |
