游标删除游标的使用和操作
上班之余抽点时间出来写写博文,希望对新接触的朋友有帮助。今天在这里和大家一起学习一下游标删除
创立游标:
alter PROC proc_order AS DECLARE @uid INT DECLARE @pid INT DECLARE @number INT DECLARE cu_order CURSOR FOR SELECT c.uid,c.pid,c.number FROM shopCar AS c INNER JOIN userTable AS u ON u.uid=c.uid WHERE u.userName=@userName OPEN cu_order FETCH NEXT FROM cu_order INTO @uid,@pid,@number WHILE @@FETCH_STATUS=0 BEGIN --PRINT @uid INSERT INTO orderDetails VALUES(@orderID,@pid,@uid,@number) FETCH NEXT FROM cu_order INTO @uid,@pid,@number END CLOSE cu_order DEALLOCATE cu_order
删除创立的游标:
DEALLOCATE myCursor2
文章结束给大家分享下程序员的一些笑话语录: 手机终究会变成PC,所以ip会比wm更加畅销,但是有一天手机强大到一定程度了就会发现只有wm的支持才能完美享受。就好比树和草,草长得再高也是草,时间到了条件成熟了树就会窜天高了。www.ishuo.cn