Hi All,
I have a table Emp_personal_details and i have around 200 records in that table.
Now I need to Insert around 400 new records into the same table. But the new records have some duplicates which are already in the DB.
How can I write a sql script to check duplicates in the table and insert the remaining records into the Appian DB.
Thanks
Discussion posts and replies are publicly visible
Hi Harika,
This can be easily done with the help of a temporary table in the database level. Below are some useful links:https://stackoverflow.com/questions/43864144/sql-avoid-duplicate-being-inserted-into-staging-temp-tablecodingsight.com/.../
Additionally, if you are using an INSERT in SQL, you can skip rows that are already present by utilizing WHERE NOT EXISTS (Select *..)..
Or if you are loading records in via Appian CDT with all 400 in it, you can iterate through a rule that checks the DB with a!queryEntity(), and retrieve the IDs for those existing rows into the CDT, which would result in an UPDATE (no change) on those and an INSERT for the new rows.
how can i do it you explain clearly, via cdt