SQL iterating over a list to call EXEC on each item
问题 Attempt to generalize my questions... I want to execute a stored procedure for each result returned by a SELECT statement. Mentally I want to try something like EXEC myStoredProc (SELECT id FROM sometable WHERE cond = @param) More details related to my specific case... I have a SaaS application. I would like to delete a tenant from the system. Before I can delete the tenant I must delete all records in the database associated with that tenant. Tenants own items such as Forms which contain