语法是这样的:
DEclare mycur scroll cursor for select * from yourtablename
open mycur
fetch absulute =1 from mycur
……
CLOSE MYCUR
DEALOCATE MYCUR
DEclare mycur scroll cursor for select * from yourtablename
open mycur
fetch absulute =1 from mycur
……
CLOSE MYCUR
DEALOCATE MYCUR
解决方案 »
- sql server 导入数据保持原有的Id不变
- 求查询语句
- 存储过程导出sql语句为什么不能到txt文件?
- DBCC SHRINKFILE (datafile, EMPTYFILE) 无法清空数据库文件
- 请教一个SQL语句,关于K线图数据的
- 请问如何新建SQL Server的登陆ID?
- 请教高手一个SQL题,小弟之前发的题是无解的,那是写错了!!!
- SSIS问题--访问XML源中的URL所需要的用户名和密码在哪儿配置?
- 为什么使用 Count(*) 会比 Sum(case) 这样的条件判断还多出一步执行计划呢?
- 3张表怎么查询?急!!
- 难度查询: 存储过程中,如何不用Select语句返回经过计算后得到的结果集合?
- 这个有问题吗?
if 入库
if exist(物品记录)
begin
select jcsl = 结存数量 from table where 物品= 物品
and 时间 = (select max(时间 ) from table where 物品 = 物品 )
insert table (,,,,结存数量)
values(,,,,jcsl + 入库数量)
end
else -- not exist(物品记录)insert table (,,,,结存数量)
values(,,,,入库数量)else ---出库 if exist(物品记录)
begin
select jcsl = 结存数量 from table where 物品= 物品
and 时间 = (select max(时间 ) from table where 物品 = 物品 )
insert table (,,,,结存数量)
values(,,,,jcsl - 出库数量)
end
else -- not exist(物品记录)
------