你先把查询中的语句生成VIEW,
再定义光标指向VIEW试一试?

解决方案 »

  1.   

    错误信息:
    ODBC: Msg 0, Level 19, State 1
    SqlDumpExceptionHandler: Process 48 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
    以前执行都正确的,现在出错,不知道why
      

  2.   

    问题可能出在A机的sql server自身。
      

  3.   

    可能是因为Cursor声明后没有释放?不知道你的SQL是否完整。如果完整的化应当有释放Cursor的语句。
    例如    DEALLOCATE DN3,or Close DN3。
      

  4.   

    当然完整,因为声明cursor时报错,若把声明语句更改为:
    DECLARE DN3 cursor for 
              select LEAVE_QTY,sid
        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 B中的sp_configure 值一样的