Derek Hanekom

Derek Hanekom

  • NA
  • 10
  • 1.5k

Overwrite in SQL not delete

Sep 12 2016 9:38 AM
I have written some code that connects to an API, returns data and populates in a SQL DB, this occurs every 1 minute as the data is dynamic.
 
I then have a C# app that looks at the db and refreshes itself every 5 seconds.
 
The problem I am facing is that, I am using a delete * statement during each timer event, as I do not want duplicates in the DB, and when this happens, for about 5 seconds, whilst the data is populating in the DB, the C# application goes blank ( which is to be expected).
 
I do use the Merge statement in another db, but I cannot indicate the source as a webservice (As far as I am aware) so taht wont help me here.
 
How do I go about successfully avoid duplicates in the DB, without using a delete * statement, without losing visual data loss?

Answers (11)