关于循环插入日期的存储过程,高手进来看一下(50)

W

wdbcpw

Unregistered / Unconfirmed
GUEST, unregistred user!
CREATE PROCEDURE sezjplantime @edate varchar(20)asbeginwhile ((select min(合同到期日) from plantime) <@edate)begininsert into seplantime(位置,幢号,室号,经营户姓名, 原合同开始日,原合同到期日,合同开始日,合同到期日,到期时间,公式年租金,垃圾费) select 位置,幢号,室号,经营户姓名,合同开始日 as 原合同开始日,合同到期日 as 原合同到期日,dateadd(yy,1,合同开始日) as 合同开始日, dateadd(yy,1,合同到期日),到期时间,公式年租金,垃圾费 from plantime where 合同到期日<@edateif (select min(合同到期日) from seplantime) >@edatebreakelsecontinueendendGO只要运行这段存储过程,程序就会长时间失去响应,高手帮我修改一下,万分感谢!
 
楼主你写的是死循环阿insert into seplantime where 合同到期日<@edate你的seplantime 表中的合同到期日是<@edate的那么你下面的这个条件怎么会成立呢?if (select min(合同到期日) from seplantime) >@edate所以是死循环阿
 
没仔细看,遇到这种问题不是可以调试吗?或者Print 出来一个串就知道原因了.授人以渔.
 

Similar threads

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