i wrote a CLR Procedure to do a similar work:
SqlString Ds_Database, (Database Name)
SqlString Ds_Procedure, (Procedure Name)
SqlString Ds_Table, (Table Name)
SqlInt32 Qt_Threads, (Numbers of Threads)
SqlInt32 Fl_Return (Return status)
1 - Create a custom procedure with parameters, which will process a unit of calc.
2 - Create a table with columns (same name of procedures parameters)
3 - Execute "stpParallel_Processing"
the procedure will pick each line of "parameters table" and call the custom procedure in parallel (Using the number of threads passed in parameter and parameters suplied in table).
it's working fine
, i'm using it to process variety of data instead of simple while loop.
in some cases, the process time is twenty times faster