Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In brief the steps are -

Code Block
languagesql
SELECT DATE_LOADED
FROM FILES_LOADED
WHERE
    FILE_LABCODE = 'XXXXX' AND
	FILENAME = 'XXXXX_20160701_20160731_ALERTS.csv'

Copy the value and then do -

Code Block
languagesql
DELETE FROM ALERT_RAW
WHERE
	DATE_LOADED = CAST('2020-09-15 08:11:29.000' AS DATETIME2)

The reason for doing it this way, rather than using DATE_OF_ALERT is that sometimes alerts are submitted outside the month. This ensures you've deleted everything that was loaded when that file was loaded.

And finally -

Code Block
languagesql
DELETE FROM FILES_LOADED
WHERE
	DATE_LOADED = CAST('2020-09-15 08:11:29.000' AS DATETIME2)

...