可能的问题:
@int_beginid ,@int_endid,@int_allid这几个表两会不会出现NULL?
其它问题:
1、declare cro_fastread cursor scroll
         for select jobno FROM tblfaultmain a left outer join tblproduct b on a.productcd = b.productcd where a.dealercd=@dealercd  and (cast(convert(char(10),a.outdate,101) as smalldatetime) between @fromdate and  @todate) and a.repairtype in('N','S','B','O') and a.iswarranty='Y' and a.repairstatus='DES' order by a.jobno
--〉
declare cro_fastread scroll cursor   ---这里是笔误吗?
         for select jobno FROM tblfaultmain a left outer join tblproduct b on a.productcd = b.productcd where a.dealercd=@dealercd  and (cast(convert(char(10),a.outdate,101) as smalldatetime) between @fromdate and  @todate) and a.repairtype in('N','S','B','O') and a.iswarranty='Y' and a.repairstatus='DES' order by a.jobno2、这个游标的定义,如果一个tblfaultmain对应多个tblproduct的纪录,那你的这个方法得到的记录数超过一页,如果保证对应至多一条tblproduct的纪录,拿这个left join 没有必要。

解决方案 »

  1.   

    给你个方法,你把语句拷贝到查询分析器,参数直接给值,加几个PRINT看看各个值是否正常。
      

  2.   

    你查找游标的定义方法啊,可以直接定义它为指向第一条和最后一条。
    declare @FieldValue float
    declare cur cursor SCROLL  for select FieldName from TableName
    open cur
    fetch last FROM cur into @FieldValue <--注意关键字last 也可以为first
    close cur
    deallocate cur
      

  3.   

    SQL SERVER 2000查询分析器中有DEBUG的功能,建议放在里面调试一下