可能的问题:
@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 没有必要。
@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 没有必要。
解决方案 »
- SQL2005 备份文件能在 sql 2000里恢复么
- 这两个触发器可以合并吗?
- MS SQL导出为ACCESS数据库.能把存储过程一起导出到ACCESS吗?
- 关于一个DTS包的问题
- 请教:如何让DTS包自动执行?另外:如何处理DTS中文本限制符的问题?
- 如何选出,某个表中的字段“日期”在今天以后的记录
- alter table 修改现有字段的长度,和类型,要保留原来的数据。
- SQL 比较两个数据库表结构差异,并生成差异结构SQL脚本
- 数据库两表查找问题!!!!!!!!!!!!!!!!!!!!!!!!!
- 在sql server 中如何取得当前用户的权限
- 怎样定期的把Access里面几个表中的数据导到Sql Server中。
- 快来拿分了
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