求助,使用游标的问题。
<p>用isql处理脚本时报这样的错误:</p><p>declare cursor must be the only statuement in a query batch.</p><p>过程为:</p><p>declare cur_lay cursor for select lay_no from #lay</p><p>declare @yw1 int<br/><br/>declare @lay_no char(12)<br/> <br/> <br/> open cur_lay fetch cur_lay into @lay_no<br/> <br/> <br/> if @@sqlstatus=0</p><p> begin<br/> <br/> select @yw1 = count(*) from center..lay_area<br/> where lay_no like <a href="mailto:'%@lay_no%'">'%@lay_no%'</a><br/> and lay_date ='20071017'<br/> <br/> insert into zdp values<br/> ( </p><p> @lay_no ,<br/> @yw1 <br/> <br/> ) <br/> <br/>fetch cur_lay into @lay_no <br/>end</p><p> <br/> close cur_lay</p><p> deallocate cursor cur_lay</p><p></p><p>请问高手我哪里写的不对?</p> <p>参考一下:</p><p><a href="http://www.sybasecn.com/sybase/dispbbs.asp?BoardID=28&ID=86&replyID=&skin=1">http://www.sybasecn.com/sybase/dispbbs.asp?BoardID=28&ID=86&replyID=&skin=1</a></p>
页:
[1]