declare @i int,@j intwhile @i <=100 begin while @j <= 10 begin .... end ... end
CREATE PROCEDURE usp_bdfd_print @string varchar(250),@strnum int,@cgrq char(10) as declare @newstring varchar(250),@i int,@x int,@wlbh char(20),@ddxc int,@x1 int set @x=0 while @x<@strnum begin set @i=charindex('-',@string+'-') set @x=@x+1 set @newstring=left(@string,@i-1) set @string=substring(@string,@i+1,500) select @wlbh=物料编号 from tblmatorderdata where 订购单编号=@newstring update tblmatordercount set 采购日期=@cgrq, 已发单标记=1 where 订购单编号=@newstring insert tblrecivematdata (订购单编号,订单项次,物料编号,到货日期,到货数量,检验日期,操作员,退货日期,退货数量,入库数量,入库日期,状态标记) select 订购单编号,订单项次,'M///','/',0,'/','/','/',0,0,'/',0 from tblmatorderdata where 订购单编号=@newstring select @ddxc=count(*) from tblmatorderdata where 订购单编号=@newstring set @x1=0 while @x1<@ddxc begin set @x1=@x1+1 select @wlbh=物料编号 from tblmatorderdata where 订购单编号=@newstring and 订单项次=@x update tblrecivematdata set 物料编号=@wlbh where 订购单编号=@newstring and 订单项次=@x end end if @@error<>0 rollback GO
select @ddxc=count(*) from tblmatorderdata where 订购单编号=@newstring 返回值是多少啊?是不是只有一条啊?
begin
while @j <= 10
begin
....
end
...
end
@string varchar(250),@strnum int,@cgrq char(10)
as
declare @newstring varchar(250),@i int,@x int,@wlbh char(20),@ddxc int,@x1 int
set @x=0
while @x<@strnum
begin
set @i=charindex('-',@string+'-')
set @x=@x+1
set @newstring=left(@string,@i-1)
set @string=substring(@string,@i+1,500)
select @wlbh=物料编号 from tblmatorderdata where 订购单编号=@newstring
update tblmatordercount
set 采购日期=@cgrq,
已发单标记=1
where 订购单编号=@newstring
insert tblrecivematdata (订购单编号,订单项次,物料编号,到货日期,到货数量,检验日期,操作员,退货日期,退货数量,入库数量,入库日期,状态标记)
select 订购单编号,订单项次,'M///','/',0,'/','/','/',0,0,'/',0 from tblmatorderdata where 订购单编号=@newstring
select @ddxc=count(*) from tblmatorderdata where 订购单编号=@newstring
set @x1=0
while @x1<@ddxc
begin
set @x1=@x1+1
select @wlbh=物料编号 from tblmatorderdata where 订购单编号=@newstring and 订单项次=@x
update tblrecivematdata
set 物料编号=@wlbh
where 订购单编号=@newstring and 订单项次=@x
end
end
if @@error<>0
rollback
GO
返回值是多少啊?是不是只有一条啊?