USP_BBNC_TRANSACTION_DELETEBATCH

Parameters

Parameter Parameter Type Mode Description
@IDS xml IN

Definition

Copy


      CREATE procedure dbo.USP_BBNC_TRANSACTION_DELETEBATCH
      (
      @IDS xml = null
      )
      as
      begin try
      --Clears Blackbaud Internet Solutions transactions from the list of downloaded transactions

      exec dbo.USP_BBNC_TRANSACTION_CLEARDOWNLOADEDTRANSACTIONS @IDS;

        --Mark downloaded transactions as unsuccessful in BBIS

      declare @TRANSACTIONIDS table 
      (
          ID int
        )

      insert into @TRANSACTIONIDS 
      select 
        [ID]
      from 
        dbo.UFN_BBNC_TRANSACTIONDS_FROMXML(@IDS);

       -- Cursor through each transaction id in table

      declare @TRANSACTIONID int;
      declare IDCURSOR cursor local fast_forward for 
      select 
        ID 
      from 
        @TRANSACTIONIDS;

      open IDCURSOR;
      fetch next from IDCURSOR into @TRANSACTIONID;
      while @@FETCH_STATUS = 0
          begin
                exec dbo.spTransactions_ReleaseDownloadLockByID @TRANSACTIONID
                fetch next from IDCURSOR into @TRANSACTIONID;
            end

      --When a cursor is used, it should be explicitly closed/deallocated in case of blocking or USP running long

      close IDCURSOR;
      deallocate IDCURSOR;

      end try

      begin catch
          exec dbo.USP_RAISE_ERROR;
          return 1;
      end catch

      return 0;