nelreina
8/23/2017 - 7:23 PM

run-insert-statement-x-number-of-times

run-insert-statement-x-number-of-times

create procedure insert_into_b
    @numInserts int
as
begin
    while @numInserts > 0
    begin
        insert into b (id)
        select id from a
        set @numInserts = @numInserts - 1
    end
end

exec insert_into_b 2