出错!求救!

douguiniao 2006-04-28 01:45:05
在MSSQL数据库里执行一个存储过程没有问题!
但是,
用JSP调用这个过程就有问题!
一到第62个记录就会终止!


这个过程如下:


create proc batch_dh
(
@id char(10)
)
as
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch in c:\upload\batch.txt -c -q -S"sidi" -U"" -P""'


declare batch_cur cursor for select left(mobile,11) from batch
open batch_cur
declare @mobile char(11)
fetch next from batch_cur into @mobile
while @@fetch_status=0
begin
if left(@mobile,3) not in ('130','131','132','133') or len(@mobile)<>11
begin
insert batch_nul(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
else
begin
if exists(select mobile from ticq.dbo.tdtuserinfo where left(mobile,11)=@mobile) or exists(select mobile from ticq.dbo.tdt_history where left(mobile,11)=@mobile)
begin
insert batch_fal(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
else
begin
insert batch_suc(name,mobile,starttime,state,item)
values(@id,@mobile,getdate(),1,'dh')
end
end
fetch next from batch_cur into @mobile
end
close batch_cur
deallocate batch_cur
delete from batch

declare batch_add cursor
for select mobile from batch_suc where item='dh' and state=1
open batch_add
declare @mobile_add char(11)
fetch next from batch_add into @mobile_add
while @@fetch_status=0
begin
exec add_dh @mobile_add,@id
fetch next from batch_add into @mobile_add
end
close batch_add
deallocate batch_add

insert batch
select mobile from batch_suc where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\suc.txt -c -q -S"sidi" -U"" -P""'
delete from batch
insert batch
select mobile from batch_fal where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\fal.txt -c -q -S"sidi" -U"" -P""'
delete from batch
insert batch
select mobile from batch_nul where item='dh' and state=1
EXEC master.dbo.xp_cmdshell 'bcp temp1.dbo.batch out c:\upload\nu.txt -c -q -S"sidi" -U"" -P""'
delete from batch

调用代码如下

CallableStatement cstm1=con.prepareCall("{call temp2.dbo.batchzc_dh_1(?,?)}");
cstm1.setString(1,tempid);
cstm1.setString(2,gongsi);
cstm1.execute();
cstm1.close();
CallableStatement cstm2=con.prepareCall("{call temp2.dbo.batchzc_dh_3(?)}");
cstm2.setString(1,tempid);
cstm2.execute();
...全文
51 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧