USP_MKTCONSTITUENTFILEIMPORTPROCESS_DELETE
Executes the "Segmented House File Import Delete" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being deleted. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the delete. |
Definition
Copy
CREATE procedure dbo.[USP_MKTCONSTITUENTFILEIMPORTPROCESS_DELETE]
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
if @CHANGEAGENTID is not null
set CONTEXT_INFO @CHANGEAGENTID;
declare @SEGMENTATIONID uniqueidentifier;
select
@SEGMENTATIONID = [SEGMENTATIONID]
from dbo.[MKTCONSTITUENTFILEIMPORTPROCESS]
where [ID] = @ID;
/* Don't let the user delete a house file in use by an activated marketing effort. */
if exists ( select 1 from dbo.[MKTSEGMENTATION] where [ID] = @SEGMENTATIONID and [ACTIVE] = 1 )
raiserror('BBERR_MARKETINGEFFORTACTIVE', 13, 1);
/* Remove all the data rows for this constituent file import */
exec dbo.[USP_MKTCONSTITUENTFILEIMPORTPROCESS_ROLLBACKIMPORT] @ID;
/* Delete constituent file import record */
exec dbo.USP_MKTCONSTITUENTFILEIMPORTPROCESS_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
/* Delete cache info for mailing */
delete from dbo.[MKTSEGMENTATIONSEGMENTCACHEINFO]
from dbo.[MKTSEGMENTATIONSEGMENTCACHEINFO] as [CACHE]
inner join dbo.[MKTSEGMENTATIONSEGMENT] on [MKTSEGMENTATIONSEGMENT].[ID] = [CACHE].[SEGMENTID]
where [MKTSEGMENTATIONSEGMENT].[SEGMENTATIONID] = @SEGMENTATIONID;
return 0;