USP_BBNC_GETBATCHBBNCTRANIDS

Retrieves a list of all Blackbaud Internet Solutions transaction ids in batches from the instance ID specified for BBIS whose statuses are open, waiting for approval, or approved.

Parameters

Parameter Parameter Type Mode Description
@BATCHID uniqueidentifier IN

Definition

Copy


            CREATE procedure [dbo].[USP_BBNC_GETBATCHBBNCTRANIDS](@BATCHID uniqueidentifier)
            with execute as owner
            as

            begin
                declare @TABLENAME nvarchar(128);
                declare @SQL nvarchar(300);

                select top 1 @TABLENAME = BATCHTYPECATALOG.BASETABLENAME
                    from dbo.BATCH
                    inner join dbo.BATCHTEMPLATE on BATCH.BATCHTEMPLATEID = BATCHTEMPLATE.ID
                    inner join dbo.BATCHTYPECATALOG on BATCHTEMPLATE.BATCHTYPECATALOGID = BATCHTYPECATALOG.ID
                    where BATCH.ID = @BATCHID
                    order by BATCH.DATEADDED;

                if not @TABLENAME is null
                    begin
                        set @SQL = N'select BBNCTRANID from dbo.' + @TABLENAME + N' inner join dbo.BATCH on ' + @TABLENAME + N'.BATCHID = BATCH.ID ';
                        set @SQL = @SQL + N'where BATCH.STATUSCODE = 0';
                        exec sp_executesql @SQL;
                    end
                else
                    select 0 as BBNCTRANID from dbo.BATCH where ID = '00000000-0000-0000-0000-000000000000'
            end