UFN_SITEID_MAPFROM_BATCHTEMPLATEID
Maps an BATCHTEMPLATEID to a SITEID.
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@BATCHTEMPLATEID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_SITEID_MAPFROM_BATCHTEMPLATEID
(
@BATCHTEMPLATEID uniqueidentifier
)
returns @SITES table (SITEID uniqueidentifier)
as
begin
insert into @SITES(SITEID)
select BATCHTEMPLATE.SITEID from dbo.BATCHTEMPLATE where ID = @BATCHTEMPLATEID;
if (select count(SITEID) from @SITES) = 0 --If no site has been assigned, then the batch template 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