I want to know the sql statement(s) to use to delete old data and the association to the old data without deleting the more important parent table, which should live forever.
I have the following tables:
Step
Id bigint
OccurredOn datetime
ScreenshotId bigint
Screenshot
Id bigint
Data varbinary(max)
I want to delete all Screenshots records associated with Steps where OccurredOn is more than 30 days old. The Steps would still be persisted with a null ScreenshotId.
What is the best SQL Statement(s) to do this?
Use: