这段SQL语句有问题吗?
以下UPDATE语句不用变量时可正确执行,用了变量检查语法没错,但就是不执行WHILE中的语句,看不出哪里有错?各位帮我看看
declare @size int,@i int
set @size=1000
set @i=0
while @i>=723
begin
update a set a.lotid=b.id from scraprawdata a left join lotgeneral b
on a.location=b.location and a.line=b.line and a.so=b.so and a.stdate=b.stdate and a.endate=b.endate and a.proddate=b.proddate and a.code=b.code
where a.id between @size*@i+1 and @size*(@i+1)
set @i=@i+1
end