USP_REPORT_SPONSORSHIPBATCHCONTROLREPORT
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@BATCHID | uniqueidentifier | IN |
Definition
Copy
create procedure dbo.USP_REPORT_SPONSORSHIPBATCHCONTROLREPORT (@BATCHID uniqueidentifier) with execute as owner
as
declare @TABLENAME nvarchar(128)
declare @SQL nvarchar(4000);
select @TABLENAME = dbo.UFN_BATCH_GETREPORTTABLENAME(@BATCHID, 0)
if @TABLENAME is null or OBJECT_ID(@TABLENAME) is null
raiserror('Sponsorship batch control table could not be found. This batch does not have any committed data to report. ',13,1)
begin try
set @SQL = N'set nocount on;
select
ID,
CONSTITUENTNAME,
LOOKUPID,
DESCRIPTION,
NAME,
TYPE,
DATE,
PROGRAM
from dbo.' + @TABLENAME + '';
exec sp_executesql @SQL;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;