create proc pro_Inventory_Qbasbegin declare @serial_no varchar(30),@QB2_COUNT int,@QB5_COUNT int,@QB10_COUNT int, @QB20_COUNT int,@QB30_COUNT int,@insert_date varchar(10) select @insert_date=str_replace(convert(varchar(10),getdate(),111),'/','-') delete from QB_REPERTORY_LIST where QB_STAT_DATE=@insert_date select @QB2_COUNT=count(*) from T_96366_2 where BZ='1' select @QB5_COUNT=count(*) from T_96366_5 where BZ='1' select @QB10_COUNT=count(*) from T_96366_10 where BZ='1' select @QB20_COUNT=count(*) from T_96366_20 where BZ='1' select @QB30_COUNT=count(*) from T_96366_30 where BZ='1' select @serial_no=convert(varchar,(isnull(max(convert(integer,QB_SERIAL_NO)),0))+1) from QB_REPERTORY_LIST insert into QB_REPERTORY_LIST values(@serial_no,@QB2_COUNT,@QB5_COUNT,@QB10_COUNT,@QB20_COUNT,@QB30_COUNT,@insert_date)end