SELECT pk from mytable where fk = @fk foreach_row_in_result_above { do something with the fk from the row (pass fk to another SP) }