USP_POPULATESEARCHCONSTITUENT_FROMTABLE
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@TABLENAME | nvarchar(128) | IN | |
@CONSTITUENTCOLUMN | nvarchar(128) | IN |
Definition
Copy
CREATE procedure dbo.USP_POPULATESEARCHCONSTITUENT_FROMTABLE (
@TABLENAME as nvarchar(128),
@CONSTITUENTCOLUMN as nvarchar(128) = 'CONSTITID'
) as
-- Performs the repopulation of the SEARCHCONSTITUENT table (used by the new constituent matching algorithm)
-- for a set of constituents that were skipped by the regular maintenance triggers by a bulk process.
--
begin
begin try
declare @SQL nvarchar(max)
set @SQL =
'delete from dbo.SEARCHCONSTITUENT
where CONSTITUENTID in(select ' + @CONSTITUENTCOLUMN + ' from ' + @TABLENAME + ' s)';
exec sp_executesql @SQL
exec dbo.USP_INSERTSEARCHCONSTITUENT @TABLENAME, @CONSTITUENTCOLUMN
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;
end