SQL2000运行语句出错求帮忙
declare @i int
set @i = 1 ---一阶
declare @t table(id varchar (64), BillId int , MGoodsId int,
MQty decimal(18,5), BomVer char(32), ItemNo int ,
GoodsId int, Qty decimal(18,5), BomId char(32),
BomIdName char(32), Price decimal(18,5), AM decimal(18,5),
LevelId int , PPRICE decimal(18,5) , CAMT decimal(18,5)
, DD1 VARCHAR(64) , DD3 VARCHAR(64) )
---Bomid=子件BOMID?bomidname=子件版本名称?
insert @t
select a.BillId, a.BillId, a.GoodsId,
a.Qty, a.BomVer, b.ItemNo,
b.GoodsId, b.Qty, b.BomId,
c.BOMVER AS BomIdName, d.Price, b.Qty*d.Price AS AM,
@i , D.PPRICE , B.QTY*D.PPRICE AS CAMT , B.DD1 , B.DD3
from vip_M_BOMV1 a ----主
join vip_M_BOMV2 b ON a.BillId = b.BillId ---从
left join vip_M_BOMV1 c ON b.BomId = c.bomver --------改为
join vip_R_GOODSPRICE() d ON b.GoodsId = d.GoodsId
while @i <= 10 AND @@RowCount <> 0
begin
set @i = @i + 1
insert @t
select a.ID+','+cast(b.billid as varchar(32)), b.BillId, a.BomIdName,
a.Qty, a.BomIdName, b.ItemNo,
b.GoodsId, b.Qty, b.BomId,
c.BOMVER AS BomIdName, d.Price, b.Qty*d.Price AS AM,