急需解决的SQL问题? (100分)

B

buff

Unregistered / Unconfirmed
GUEST, unregistred user!
有以下sql:
DECLARE DN3 cursor for
select LEAVE_QTY,sid,
(select sum(isnull(LEAVE_QTY,0)) from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0 And stock_product_Num='020103007' and convert(varchar(8),expire_date,112)=convert(varchar(8),convert(datetime,'2003-09-30'),112))as qty --合计该类商品数量
from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0 And stock_product_Num='020103007' and convert(varchar(8),expire_date,112)=convert(varchar(8),convert(datetime,'2003-09-30'),112)
在A机 sql7下执行出错,在B机sql 7 中执行正确,
在A机中只执行:
select LEAVE_QTY,sid,
(select sum(isnull(LEAVE_QTY,0)) from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0 And stock_product_Num='020103007' and convert(varchar(8),expire_date,112)=convert(varchar(8),convert(datetime,'2003-09-30'),112))as qty --合计该类商品数量
from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0 And stock_product_Num='020103007' and convert(varchar(8),expire_date,112)=convert(varchar(8),convert(datetime,'2003-09-30'),112)
正确,不定义光标就可以,各位高手请提示。
非常之急!
 
给你整理整理再贴出来。
DECLARE DN3 cursor for
select LEAVE_QTY,sid,
(select sum(isnull(LEAVE_QTY,0))
from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0
and stock_product_Num='020103007'
and expire_date='2003-09-30')as qty --合计该类商品数量
from stock_product
where stock_code='01' and isnull(LEAVE_QTY,0)>0
and stock_product_Num='020103007'
and expire_date='2003-09-30'

你先用sp_configure看看A机和B机的SQL7有什么不同。

不太明白你要做什么,你把你的表结构贴出来大家探讨一下。
建议你最好不要用游标,考虑其他思路能不能解决。
 
[red][/red]请把出错的消息告诉大家。可能是你在A的权限不够。
 
错误是:
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 48 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
以前执行没有问题,放假回来就不行了
 
没有办法拆开处理了
 
我提一个思路,是否是日期格式的设置有问题?
看看控制面板里区域设置中的日期格式,设成'yyyy-mm-dd'
 
你看看是不是日志空间或临时表空间满了?
 
问题 变相解决,还是 谢谢大家!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
762
import
I
S
回复
0
查看
846
SUNSTONE的Delphi笔记
S
顶部