日期:2014-05-19  浏览次数:20577 次

请问如何取出由游标指定的那一行呢?如下
declare   @a   as   char(16)
declare       myCursor           CURSOR   for      
select   top   10     lotid       from       lot      

open       myCursor      

FETCH       next       FROM       myCursor  
CLOSE       myCursor    
DEALLOCATE       myCursor  
上面中取出来第一行的lotid
如何付给一个变量呢
  select   top   10   @a=lotid   from   lot不成立

thanks

------解决方案--------------------
declare @a as char(16)
declare myCursor CURSOR for
select top 10 lotid from lot

open myCursor

FETCH next FROM myCursor into @变量名
CLOSE myCursor
DEALLOCATE myCursor