sql语句游标的写法


当循环查找一张表的信息时,我们得写一张游标来对每条信息进行操作,具体格式如下

 

DECLARE @fitemid int

DECLARE #point_cursor CURSOR
FOR
SELECT fitemid
FROM ICStockBillEntry where finterid=1314     --每条信息从头到尾的写入
OPEN #point_cursor
FETCH NEXT FROM #point_cursor INTO @fitemid
while @@fetch_status = 0
BEGIN
select @fitemid= from table          --具体的逻辑
FETCH NEXT FROM #point_cursor INTO @fitemid
END
CLOSE #point_cursor
DEALLOCATE #point_cursor


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM