...
In brief the steps are -
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
DELETE FROM FILES_LOADED WHERE DATE_LOADED = CAST('2020-09-15 08:11:29.000' AS DATETIME2) |
...