i am passing in a vi_date and vi_qty. i want the insert to loop for as
many times as the vi_qty specifies. thought this would work, but it's not
:( at the same time - do a check that if the sql_date is null, assign it
the one that i get from the select query.
thanks for any assistance.
declare n int
declare v_date datetime
select n = 0
select v_date = vi_date
IF v_date is null
select v_date = MAX(sql_date)+1
if rowcount = 0
set v_date = getdate()
while n <= vi_qty
insert into ...