USE [ISDB]
GO
/****** Object: StoredProcedure [dbo].[ISAutoDocChrg] Script Date: 5/15/2010 2:12:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ISAutoDocChrg] AS
/* ----------------------------------------CURSER VALRIABLE>>>>>>>>>>>>>>> */
DECLARE @ConsigneeTIN varchar(17),
@InstanceId nchar(10),
@PPC varchar(17),
@OfficeCd varchar(5),
@NoticeDate datetime,
@IDE_TYP_TYP char(1),
@DeclarantTIN varchar(11),
@Sad_Reg_serial varchar(1),
/* ---------------------------------------CURSER VALRIABLES<<<<<<<<<<<<<< */
/*--------------------------------------SVAT Variables >>>>>>>>>>>>>>>>>>>>> */
@SVATAmount money,
@VATAmount money,
@NSVATAmount money,
@SVATStatus varchar,
@Balance money,
-- Version 1.2 >>
@InvestorTIN varchar(11),
@InvTIN varchar(11),
@InvestorPPC varchar(17),
@PPC_ChkCount smallint,
@TypeofCompany varchar(1),
@PPCCount int,
@DecOnAccCount int,
@InvOnAccCount int,
@OnAcc_DecCount smallint,
@OnAcc_ConsiCount smallint,
-- Version 1.2 <<
/*-------------------------------------Create References>>>>>>>>>>>>>>>>>>>>*/
@TheCount1 int,
@TheCount2 varchar(4),
@RefNo varchar(11) ,
@CostCentercd varchar(3),
@Doc_ChgCont smallint,
@NoteType char(2),
@DOCSVATAmount money,
@DOCVATAmount money,
@DOCNSVATAmount money,
@GRNSVATAmount money,
@GRNVATAmount money,
@GRNNSVATAmount money,
@ChrgCatCd Varchar(10)
SELECT @DOCSVATAmount= RATE,@DOCNSVATAmount=TOTAL,@DOCVATAmount=TAX
FROM dbo.ISChrgCatRate
where Version='0' and ChrgCatCd='010104'
SELECT @GRNSVATAmount= RATE,@GRNNSVATAmount=TOTAL,@GRNVATAmount=TAX
FROM dbo.ISChrgCatRate
where Version='0' and ChrgCatCd='010105'
/*--------------------------------------SVAT Variables <<<<<<<<<<<<<<<<<<<< */
/*--------------------------------------Create Csr>>>>>>>>>>>>>>>>>>>>>>>>>*/
DECLARE @getgetCusDec_BOI CURSOR
SET @getgetCusDec_BOI= CURSOR
FOR
SELECT ConsigneeTIN, InstanceId,PPC,OfficeCd,Doc_Chg_Date,Doc_ChgCont,IDE_TYP_TYP,DeclarantTIN,PPC_ChkCount,InvTIN,OnAcc_DecCount,OnAcc_ConsiCount,Sad_Reg_serial
FROM CusDec_BOI where Doc_Chg_Flag='0'
/*--------------------------------------Create Csr<<<<<<<<<<<<<<<<<<<<<<<<<*/
OPEN @getgetCusDec_BOI
FETCH NEXT
FROM @getgetCusDec_BOI INTO @ConsigneeTIN,@InstanceId,@PPC,@OfficeCd,@NoticeDate,@Doc_ChgCont,@IDE_TYP_TYP,@DeclarantTIN,@PPC_ChkCount,@InvTIN,@OnAcc_DecCount,@OnAcc_ConsiCount,@Sad_Reg_serial
WHILE @@FETCH_STATUS = 0
BEGIN
set @Balance=0
set @SVATStatus=null
IF (@Sad_Reg_serial='G'or @Sad_Reg_serial='Y')
BEGIN
SET @SVATAmount =@GRNSVATAmount
SET @VATAmount=@GRNVATAmount
SET @NSVATAmount=@GRNNSVATAmount
SET @ChrgCatCd = '010105'
END
ELSE
BEGIN
SET @SVATAmount=@DOCSVATAmount
SET @VATAmount=@DOCVATAmount
SET @NSVATAmount=@DOCNSVATAmount
SET @ChrgCatCd = '010104'
END
SET @InvestorTIN=NULL
SET @InvestorPPC=NULL
SET @PPCCount=0
PRINT @InstanceId + 'COSDEC in Service'
SET @NoteType=NULL
if (substring(@PPC,15,2)='00')
BEGIN --(A)
PRINT 'BOI PPC'
SELECT @InvestorTIN=TIN,@InvestorPPC=WareHouseCd
FROM ISWareHouse
--where InvPPC=@PPC
where WareHouseCd=@PPC
SELECT @PPCCount=COUNT(WareHouseCd)
FROM ISWareHouse
--FROM ISInvSubContractLnk
--where InvPPC=@PPC
where WareHouseCd=@PPC
SET @NoteType='09'
--Notification /@PPC_ChkCount
END --(A)
ELSE -- IF (substring(@PPC,8,1)='S')
BEGIN --(B)
PRINT 'SUB PPC'
SELECT @InvestorTIN=TIN,@InvestorPPC=WareHouseCd
FROM ISWareHouse
where WareHouseCd=substring(@PPC,1,14) + '00'
SELECT @PPCCount=COUNT(WareHouseCd)
FROM ISWareHouse
where WareHouseCd=@PPC
SET @NoteType='10'
--Notification /@PPC_ChkCount
END --(B)
--if(@InvestorTIN=NULL AND @InvestorPPC=NULL AND @PPC_ChkCount=0)
if(@PPCCount=0 AND @PPC_ChkCount=0)
--PRINT ' <Investor NOT Identified... [PPCCODE/ LINK TABLE]'
-- TOP 7 IF
BEGIN--(C)
PRINT '<Investor NOT Identified[WareHouse Table]'
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
BEGIN TRAN T7
Update CUSDEC_BOI Set PPC_ChkDate=getdate(),PPC_ChkCount=1 where InstanceId=@InstanceId
--Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Values(@ConsigneeTIN,@RefNo,'01',@InstanceId,'SYS')
-- Version 1.2
-- Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
IF @@error <> 0
ROLLBACK TRAN T7
COMMIT TRAN T7
END --(C)
--ELSE if(@InvestorTIN<>NULL AND @InvestorPPC<>NULL)
ELSE IF(@PPCCount>0)
-->> TOP 7 ELSE BEGIN
BEGIN --(D)
PRINT 'Investor Identified> ' + @InvestorTIN + '[TIN]> ' + @InvestorPPC + '[PPC]> '
--if (@InvTIN is Null and @InvestorTIN is not null)
if (@InvestorTIN is not null)
BEGIN
Update CusDec_BOI set InvTIN=@InvestorTIN where InstanceId=@InstanceId
END
-- Took it below @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ >>
set @DecOnAccCount=0
SELECT @DecOnAccCount = COUNT(TIN_SubTIN)
FROM ISOnAcctRegistry
where TIN_SubTIN=@DeclarantTIN and Status='1'
if (@DecOnAccCount>0)
BEGIN
SELECT @Balance= Balance
FROM ISOnAcctRegistry
where TIN_SubTIN=@DeclarantTIN and Status='1'
PRINT 'DECLARANT FOUND IN OnAccount> ' + @DeclarantTIN + ' BALANCE> ' +convert(varchar,@Balance)
END
ELSE IF (@DecOnAccCount=0 AND @OnAcc_DecCount=0 )
BEGIN
PRINT 'DECLARANT NOT FOUND IN OnAccount [Cannot Proceed]> ' + @DeclarantTIN
set @NoteType='11'
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
BEGIN TRAN T8
Update CUSDEC_BOI Set OnAcc_DecDate=getdate(),OnAcc_DecCount=1 where InstanceId=@InstanceId
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
IF @@error <> 0
ROLLBACK TRAN T8
COMMIT TRAN T8
END
-- Took it below @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <<
SET @InvOnAccCount=0
SELECT @InvOnAccCount=COUNT(TIN_SubTIN)
FROM ISOnAcctRegistry
where TIN_SubTIN=LEFT(@InvestorTIN,9) and Status='1'
IF (@InvOnAccCount>0 AND @DecOnAccCount>0)
BEGIN
SELECT @SVATStatus=SVATStatus
FROM ISOnAcctRegistry
where TIN_SubTIN=left(@InvestorTIN,9) and Status='1'
PRINT 'INVESTOR FOUND IN OnAccount> ' + LEFT(@InvestorTIN,9) + ' ' + 'SVAT STATUS> ' + @SVATStatus
END
ELSE IF (@InvOnAccCount=0 AND @OnAcc_ConsiCount=0 AND @DecOnAccCount>0)
BEGIN
PRINT 'INVESTOR NOT FOUND IN OnAccount for SVAT STATUS [Cannot Proceed]> ' + LEFT(@InvestorTIN,9)
set @NoteType='12'
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
BEGIN TRAN T9
Update CUSDEC_BOI Set OnAcc_ConsiDate=getdate(),OnAcc_ConsiCount=1 where InstanceId=@InstanceId
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
IF @@error <> 0
ROLLBACK TRAN T9
COMMIT TRAN T9
END
--PRINT 'DECLARANT>' + @DeclarantTIN + ' ' + @SVATStatus + 'Declarant Identified'
-- Version 1.2
--ISChargeSummary Insert @InvestorPPC and @DeclarantTIN
--ISOnlineNotification @DeclarantTIN Notifications will be sent to him
set @CostCentercd=null
set @NoteType=null
Select @CostCentercd=CostCenterCd From ISOfficeCode where OfficeCd=@OfficeCd
set @RefNo=null
------------------------------------PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP PPPP> (1.0)
if (@SVATStatus='1' OR @SVATStatus='2')
BEGIN
--Create Receipt Reference----------------------------------------------------------- (1.1)<
if (@Balance>=@SVATAmount)
BEGIN
EXEC CreateIndexCommon
@IndexType = 'CH',
@Ref= @RefNo OUTPUT
-- TRANS (1) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T1
if (@SVATStatus='1')
BEGIN
insert into ISChrgDetail (CHRefNo, ChrgCatCd, Qty, Amount, Tax,NetAmount)
values(@RefNo,@ChrgCatCd,'1',@SVATAmount,@VATAmount,@SVATAmount)
insert into ISChrgSummary (CHRefNo, TIN_SubTIN, PPC, TotAmount, TotTax,
NetAmount, UserEntered, DateEntered, CostCenterCd, SVATStatus,ReferenceNo)
-- Version 1.2
--values(@RefNo,@ConsigneeTIN,@PPC,@NSVATAmount,@VATAmount,@SVATAmount,'SYS',getdate(),@CostCentercd ,'1',@InstanceId)
--values(@RefNo,@DeclarantTIN,@InvestorPPC,@NSVATAmount,@VATAmount,@SVATAmount,'SYS',getdate(),@CostCentercd ,'1',@InstanceId)
values(@RefNo,@DeclarantTIN,@InvestorPPC,@SVATAmount,@VATAmount,@SVATAmount,'SYS',getdate(),@CostCentercd ,'1',@InstanceId)
END
if (@SVATStatus='2')
BEGIN
insert into ISChrgDetail (CHRefNo, ChrgCatCd, Qty, Amount, Tax,NetAmount)
values(@RefNo,@ChrgCatCd,'1',@SVATAmount,'',@SVATAmount)
insert into ISChrgSummary (CHRefNo, TIN_SubTIN, PPC, TotAmount, TotTax,
NetAmount, UserEntered, DateEntered, CostCenterCd, SVATStatus,ReferenceNo)
-- Version 1.2
--values(@RefNo,@ConsigneeTIN,@PPC,@NSVATAmount,@VATAmount,@SVATAmount,'SYS',getdate(),@CostCentercd ,'1',@InstanceId)
--values(@RefNo,@DeclarantTIN,@InvestorPPC,@NSVATAmount,'',@SVATAmount,'SYS',getdate(),@CostCentercd ,'2',@InstanceId)
values(@RefNo,@DeclarantTIN,@InvestorPPC,@SVATAmount,'',@SVATAmount,'SYS',getdate(),@CostCentercd ,'2',@InstanceId)
END
Update CUSDEC_BOI set Doc_Chg_Flag='1', Doc_Chg_Date=getdate() where InstanceId=@InstanceId
IF @@error <> 0
ROLLBACK TRAN T1
COMMIT TRAN T
END
-- Put First Notification if [@NoticeDate=NULL]
--else if (@Balance<@SVATAmount and (@NoticeDate=NULL or @NoticeDate<>convert(varchar(10),getdate(),101)) )
else if (@Balance<@SVATAmount and (@NoticeDate is NULL))
BEGIN
IF (@IDE_TYP_TYP='1')
BEGIN
SET @NoteType='01'
END
ELSE IF (@IDE_TYP_TYP='0')
BEGIN
SET @NoteType='03'
END
--Create Notification Reference----------------------------------------------------------- (1.1.2)>
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
--Insert into TESTT (Ref) values(@RefNo)
--Create Reference----------------------------------------------------------------------------- (1.1.2)<
-- TRANS (2) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T2
Update CUSDEC_BOI Set Doc_Chg_Date=getdate(),Doc_ChgCont=1 where InstanceId=@InstanceId
--Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Values(@ConsigneeTIN,@RefNo,'01',@InstanceId,'SYS')
-- Version 1.2
-- Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
IF @@error <> 0
ROLLBACK TRAN T2
COMMIT TRAN T2
END
--Put Second Reminders if First one is already sent >> convert(varchar(10),@NoticeDate,101) <>convert(varchar(10),getdate(),101))
else if (@Balance<@SVATAmount and (convert(varchar(10),@NoticeDate,101) <>convert(varchar(10),getdate(),101)) AND @Doc_ChgCont<10 )
BEGIN
IF (@IDE_TYP_TYP='1')
BEGIN
SET @NoteType='02'
END
ELSE IF (@IDE_TYP_TYP='0')
BEGIN
SET @NoteType='04'
END
--Create Notification Reference----------------------------------------------------------- (1.1.2)>
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
--Create Reference----------------------------------------------------------------------------- (1.1.2)<
-- TRANS (3) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T3
Update CUSDEC_BOI Set Doc_Chg_Date=getdate(),Doc_ChgCont=Doc_ChgCont+1 where InstanceId=@InstanceId
--Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Values(@ConsigneeTIN,@RefNo,'02',@InstanceId,'SYS')
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Version 1.2
--Values(@ConsigneeTIN,@RefNo,@NoteType,@InstanceId,'SYS')
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
IF @@error <> 0
ROLLBACK TRAN T3
COMMIT TRAN T3
END
END
------------------------------------------------------PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP> (2.0)
else if (@SVATStatus='0')
BEGIN
if (@Balance>=@NSVATAmount)
BEGIN
--Create Receipt Reference------------------------------------------------------------------ (2.1.1)>
EXEC CreateIndexCommon
@IndexType = 'CH',
@Ref= @RefNo OUTPUT
--Create Notification Reference----------------------------------------------------------- (2.1.1)<
-- TRANS (4) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T4
insert into ISChrgDetail (CHRefNo, ChrgCatCd, Qty, Amount, Tax,NetAmount)
values(@RefNo,@ChrgCatCd,'1',@SVATAmount,@VATAmount,@NSVATAmount)
insert into ISChrgSummary (CHRefNo, TIN_SubTIN, PPC, TotAmount, TotTax,
NetAmount, UserEntered, DateEntered, CostCenterCd, SVATStatus,ReferenceNo)
--Version 1.2
--values(@RefNo,@ConsigneeTIN,@PPC,@NSVATAmount,@VATAmount,@NSVATAmount,'SYS',getdate(),@CostCentercd ,'0',@InstanceId)
--values(@RefNo,@DeclarantTIN,@InvestorPPC,@NSVATAmount,@VATAmount,@NSVATAmount,'SYS',getdate(),@CostCentercd ,'0',@InstanceId)
values(@RefNo,@DeclarantTIN,@InvestorPPC,@SVATAmount,@VATAmount,@NSVATAmount,'SYS',getdate(),@CostCentercd ,'0',@InstanceId)
Update CUSDEC_BOI set Doc_Chg_Flag='1', Doc_Chg_Date=getdate() where InstanceId=@InstanceId
IF @@error <> 0
ROLLBACK TRAN T4
COMMIT TRAN T4
END
--END
--else
-- Put First Reminder/ Reminder type code is (1) >>>>>> (@NoticeDate=NULL) )
--else if (@Balance<@SVATAmount and (@NoticeDate=NULL or @NoticeDate<>convert(varchar(10),getdate(),101)) )
else if (@Balance<@NSVATAmount and (@NoticeDate is NULL) )
BEGIN
IF (@IDE_TYP_TYP='1')
BEGIN
SET @NoteType='01'
END
ELSE IF (@IDE_TYP_TYP='0')
BEGIN
SET @NoteType='03'
END
--Create Notification Reference----------------------------------------------------------- (2.2.1)>
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
--Insert into TESTT (Ref) values(@RefNo)
--Create Notification Reference----------------------------------------------------------- (2.2.1)<
/*Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, Remarks, UserEntered)
Values(@ConsigneeTIN,@RefNo,'1012',@InstanceId,'SYS') */
-- TRANS (5) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T5
--Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Values(@ConsigneeTIN,@RefNo,'01',@InstanceId,'SYS')
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Version 1.2
--Values(@ConsigneeTIN,@RefNo,@NoteType,@InstanceId,'SYS')
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
Update CUSDEC_BOI Set Doc_Chg_Date=getdate(),Doc_ChgCont=1 where InstanceId=@InstanceId
IF @@error <> 0
ROLLBACK TRAN T5
COMMIT TRAN T5
END
----------------------------------------------------------------------------------------------------------------------<
-- Send Second Reminders/ Reminder type code is (3) >>>>> (convert(varchar(10),@NoticeDate,101) <>convert(varchar(10),getdate(),101))
else if (@Balance<@NSVATAmount and (convert(varchar(10),@NoticeDate,101) <>convert(varchar(10),getdate(),101))AND @Doc_ChgCont<10 )
BEGIN
IF (@IDE_TYP_TYP='1')
BEGIN
SET @NoteType='02'
END
ELSE IF (@IDE_TYP_TYP='0')
BEGIN
SET @NoteType='04'
END
--Create Notification Reference----------------------------------------------------------- (2.2.1)>
EXEC CreateIndexCommon
@IndexType = 'ON',
@Ref= @RefNo OUTPUT
--Insert into TESTT (Ref) values(@RefNo)
--Create Notification Reference----------------------------------------------------------- (2.2.1)<
/*Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, Remarks, UserEntered)
Values(@ConsigneeTIN,@RefNo,'1012',@InstanceId,'SYS') */
-- TRANS (6) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
BEGIN TRAN T6
--Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Values(@ConsigneeTIN,@RefNo,'02',@InstanceId,'SYS')
Insert into ISOnlineNotification( TIN_SubTIN, ONRefNo, NotificationTypeCd, ReferenceNo, UserEntered)
-- Version 1.2
--Values(@ConsigneeTIN,@RefNo,@NoteType,@InstanceId,'SYS')
Values(@DeclarantTIN,@RefNo,@NoteType,@InstanceId,'SYS')
Update CUSDEC_BOI Set Doc_Chg_Date=getdate(),Doc_ChgCont=Doc_ChgCont+1 where InstanceId=@InstanceId
IF @@error <> 0
ROLLBACK TRAN T6
COMMIT TRAN T6
END
END
----------------------------------------------------------------------------------------------------------------------<
--<< TOP 7 ELSE END
END --(D)
set @ConsigneeTIN=null
set @InstanceId=null
set @PPC=null
set @OfficeCd=null
set @NoticeDate=null
set @DeclarantTIN=null
set @PPC_ChkCount=0
set @InvTIN=Null
set @OnAcc_DecCount=Null
set @OnAcc_ConsiCount=Null
set @Sad_Reg_serial=null
FETCH NEXT
FROM @getgetCusDec_BOI INTO @ConsigneeTIN,@InstanceId,@PPC,@OfficeCd,@NoticeDate,@Doc_ChgCont,@IDE_TYP_TYP,@DeclarantTIN,@PPC_ChkCount,@InvTIN,
@OnAcc_DecCount,@OnAcc_ConsiCount,@Sad_Reg_serial
END
/*---------------------------------------------------------------------------------------------------------------*/
CLOSE @getgetCusDec_BOI
DEALLOCATE @getgetCusDec_BOI
GO
答案 0 :(得分:0)
作为起点,Mate可以尝试使用 sp_who2 来查看长时间运行是否是阻塞会话的结果。