I need to delete a bunch of rows from my database under a certain condition. I have the select statement to return this condition and then for each row in this select statement I need it execute an SP that will delete these rows and a load of related rows. So far I have:
select importfileid from import.importfiles where importfilestatusid < 7
and then execute
EXEC [import].[spDeleteFromAllImportRelatedTables]
@fileID = @importfileid
I'm just not sure how to do the inbetween? If someone could point me in the right direction that would be great.
NB: This is a once off thing. Performance is not an issue.