链接服务器高难问题(两端ADSL)
(两端ADSL)已经建立链接服务器srv_lnk,本地建立了一个存储过程,执行的时候
非常慢,我已经等了几十分钟,还没有结果,数据量并不大,大概每个表300条数据,存储过程为PROC_MOVEATOB,执行为:
DECLARE @A VARCHAR(50)
EXEC PROC_MOVEATOB 'A ', 'A ', '2007-03-01 ',@A OUTPUT
部分:
CREATE PROCEDURE PROC_MOVEATOB(@FlagStr varchar(5),@BillBookNo varchar(20),@Time varchar(50),@MatchBillNo varchar(200) output)
AS
Declare @BillSale_Out varchar(50),
@OldTime int ,
@BillNo_Out varchar(20) ,
@BillType varchar(20)
Delete from ENTA.DBO.billsale where creater= '10000 ' and creattime=(convert(varchar(10),getdate(),126))
Delete from ENTA.DBO.billsaleproduct where creater= '10000 ' and creattime=(convert(varchar(10),getdate(),126))
Delete from ENTA.DBO.BillSaleIticket where creater= '10000 ' and creattime=(convert(varchar(10),getdate(),126))
Delete from ENTA.DBO.BillSaleDticket where creater= '10000 ' and creattime=(convert(varchar(10),getdate(),126))
set xact_abort on
Begin tran
Select @BillType= 'BillSale '
Exec PROC_BuildBillNo @BillType,@FlagStr,@OldTime Output ,@BillSale_Out Output
Set @MatchBillNo=@BillSale_Out /*单据编号*/
insert into ENTA.DBO.BillSale( BillNo ,UID, CustomerID , CustomerName, CustomerPersonId,CustomerPersonName,TotalAccount ,Creater, Grup )
values(@BillSale_Out, ' ', 'szid ' , '苏州东航 ', ' ', ' ', 0, '10000 ', 52)
Declare @a varchar(50),
@b varchar(50),
@NewBillSaleProductPIDNo varchar(50),
@c money,
@d money,
@all money
set @all=0
Declare BillBookproduct_Cursor CURSOR for
Select BillNo,BookPid,inprice,tax from srv_lnk.SZABC.DBO.BillSaleProduct where Creattime=@Time AND (PRODUCTID NOT LIKE '479 '+ '% ') AND (PRODUCTID NOT LIKE '731 '+ '% ')
Open BillBookproduct_Cursor
Fetch BillBookproduct_Cursor Into @a,@b,@c,@d
While (@@fetch_status <> -1)
begin
PRINT @A
PRINT @B
set @all=@all+@c+@d
Select @BillType= 'BillSaleProduct '
/*单据编号*/
--Exec PROC_BuildBillNo