USP_REPORT_CONSTITUENTADDRESSUPDATEBATCHCONTROLREPORT
Returns the data necessary for the Constituent Address Update Batch Control report.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@BATCHID | uniqueidentifier | IN |
Definition
Copy
CREATE procedure dbo.USP_REPORT_CONSTITUENTADDRESSUPDATEBATCHCONTROLREPORT(@BATCHID uniqueidentifier)
with execute as owner
as
declare @TABLENAME nvarchar(128);
set nocount on;
select @TABLENAME = dbo.UFN_BATCH_GETREPORTTABLENAME(@BATCHID, 0)
declare @SQLTOEXEC nvarchar(1000);
set @SQLTOEXEC = N'set nocount on;
declare @cnt int;
select @cnt = COUNT(*)
from INFORMATION_SCHEMA.COLUMNS
where (TABLE_SCHEMA = ''dbo'')
and (TABLE_NAME = ''' + @TABLENAME + ''')
and (COLUMN_NAME = ''ISGROUP'');
if @cnt > 0
begin
select
ID, ISORGANIZATION, CONSTITUENTNAME, ADDRESSBLOCK, CITY, STATE, ISGROUP
from dbo.' + @TABLENAME + '
end
else
begin
select
ID, ISORGANIZATION, CONSTITUENTNAME, ADDRESSBLOCK, CITY, STATE, 0 ISGROUP
from dbo.' + @TABLENAME + '
end';
exec sp_executesql @SQLTOEXEC;