vendredi 15 juillet 2016

SQL check if record exists in table before bulk insert

I currently have a stored procedure that performs bulk insert into a table named "TomorrowPatients" from a .csv file. When performing the bulk insert, I need to determine if the record being added already exists within the table and if so DO NOT add the record. If the record does not exist then I need to APPEND it to the table. What is the most efficient way to go about this? Any help will be greatly appreciated.

EDIT: I have created a temp table called "TomorrowPatients_Temp". I am trying to use this table to determine which records to insert.

Aucun commentaire:

Enregistrer un commentaire