USP_CAMPAIGNSITE_VALIDATESITES
Checks that a site has only been defined once for a given campaign.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CAMPAIGNSITES | xml | IN |
Definition
Copy
create procedure dbo.USP_CAMPAIGNSITE_VALIDATESITES(@CAMPAIGNSITES xml)
with execute as caller
as
declare @SITECOUNT int;
declare @ERRORMESSAGE nvarchar(max);
declare @SITESTABLE table
(
ID int,
SITEID uniqueidentifier
);
insert into @SITESTABLE(SITEID) select SITEID from dbo.UFN_CAMPAIGN_GETSITES_FROMITEMLISTXML(@CAMPAIGNSITES);
declare @DULICATEID uniqueidentifier
select top 1 @DULICATEID = SITEID from dbo.UFN_CAMPAIGN_GETSITES_FROMITEMLISTXML(@CAMPAIGNSITES) as SITES group by SITEID having count(SITEID) > 1
if @DULICATEID is not null begin
select @ERRORMESSAGE = NAME + ' is selected more than once.' from dbo.SITE where SITE.ID = @DULICATEID;
raiserror(@ERRORMESSAGE, 13, 1);
end