use sale
go
--定义update_retailprice游标
declare update_retailprice cursor
local
scroll
dynamic
scroll_locks
for
select * from allstorage w
where stockprice>retailprice or stockprice>memberprice or stockprice>wholesaleprice
for update of retailprice
--打开游标
open update_retailprice
--提取数据纪录
fetch next from update_retailprice
--更新retailprice
update allstorage set retailprice=memberprice+1
where current of update_retailprice
--关闭游标
close update_retailprice
--删除游标
deallocate update_retailprice
go
10 个解决方案
#1
纠正一下,应该是这个存储过程:
use sale
go
if exists(select name from sysobjects
where name='allstorage_cursor' and type='p')
drop procedure allstorage_cursor
go
create proc allstorage_cursor @var_cursor cursor varying output --输出游标参数
as
set @var_cursor=cursor forward_only static for --定义游标
select barcode,itemclass,itemname retailprice,stockprice,remainquantity
from allstorage
open @var_cursor
go
use sale
go
if exists(select name from sysobjects
where name='allstorage_cursor' and type='p')
drop procedure allstorage_cursor
go
create proc allstorage_cursor @var_cursor cursor varying output --输出游标参数
as
set @var_cursor=cursor forward_only static for --定义游标
select barcode,itemclass,itemname retailprice,stockprice,remainquantity
from allstorage
open @var_cursor
go
#2
顶
#3
没人用过吗?
#4
恩
#5
用Set Rs=Con.Exectue(存储过程)看看
#6
确实比较少见的用法,学习
#7
长见识啦!
#8
再顶
#9
用力顶
#10
最好一顶,没力气拉
#1
纠正一下,应该是这个存储过程:
use sale
go
if exists(select name from sysobjects
where name='allstorage_cursor' and type='p')
drop procedure allstorage_cursor
go
create proc allstorage_cursor @var_cursor cursor varying output --输出游标参数
as
set @var_cursor=cursor forward_only static for --定义游标
select barcode,itemclass,itemname retailprice,stockprice,remainquantity
from allstorage
open @var_cursor
go
use sale
go
if exists(select name from sysobjects
where name='allstorage_cursor' and type='p')
drop procedure allstorage_cursor
go
create proc allstorage_cursor @var_cursor cursor varying output --输出游标参数
as
set @var_cursor=cursor forward_only static for --定义游标
select barcode,itemclass,itemname retailprice,stockprice,remainquantity
from allstorage
open @var_cursor
go
#2
顶
#3
没人用过吗?
#4
恩
#5
用Set Rs=Con.Exectue(存储过程)看看
#6
确实比较少见的用法,学习
#7
长见识啦!
#8
再顶
#9
用力顶
#10
最好一顶,没力气拉