UFN_SITEID_MAPFROM_IMPORTSOURCEID

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@IMPORTSOURCEID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SITEID_MAPFROM_IMPORTSOURCEID
(
  @IMPORTSOURCEID uniqueidentifier
)
returns @SITES table (SITEID uniqueidentifier)
as
begin
  insert into @SITES(SITEID)
  select SITEID from dbo.IMPORTSOURCE where ID = @IMPORTSOURCEID;

  if (select count(SITEID) from @SITES) = 0 --If no site has been assigned, then the import source 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