UFN_SITEID_MAPFROM_ADDRESSVALIDATIONID

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@ADDRESSVALIDATIONID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SITEID_MAPFROM_ADDRESSVALIDATIONID
(
    @ADDRESSVALIDATIONID uniqueidentifier
)
returns @SITES table (SITEID uniqueidentifier)
as
begin
  insert into @SITES(SITEID)
  select ADDRESSVALIDATION.SITEID from dbo.ADDRESSVALIDATION where ID = @ADDRESSVALIDATIONID;

  if (select count(SITEID) from @SITES) = 0 --If no site has been assigned, then the address validation is unsecured and available to all sites.

  begin
    insert into @SITES(SITEID) values (null);
    insert into @SITES(SITEID) select ID from dbo.SITE;
  end

  return;
end