' declare @i int; '+ ' set @i=0; '+ ' while @i<4 '+ ' begin '+ ' insert into NBCommission(Type,ItemNo,Unit,Amount,CType) '+ ' select convert (varchar,@i),a.ItemNo,b.code,''0'',''0'' from InvtItemItem a,Nbunit b where a.unit=b.code and '+ ' (not exist…