sql - Can you run a portion of a script in parallel, based off the results of a select statement? -
i have portion of code which, when simplified, looks this: select @mainlooptableid = min(uid) queueofids (nolock) while (@mainlooptableid not null) begin -- large block of code several things depending on nature of @mainlooptableid -- . -- . -- . -- end of blocks main logic delete queueofids uid = @mainlooptableid select @mainlooptableid = min(uid) queueofids (nolock) end i able run segment of code that's inside while loop parallel uids inside queueofids table. based on happens inside loop i can guarantee not interfere each other in way if run concurrently, logically seems safe run this. real question if there way sql run portion of code values in there? note: did think generating temp table series of created sql statements stored strings, each 1 identical except @mainlooptableid value. if have table of sql statements ready execute, i'm not sure how of these statements execute concurrently. i can't think of way...