UFN_MKTSOURCECODE_GETDEFAULTSOURCECODEID

Returns the ID of the default source code available to the current user.

Return

Return Type
uniqueidentifier

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN

Definition

Copy


CREATE function dbo.[UFN_MKTSOURCECODE_GETDEFAULTSOURCECODEID]
(
  @CURRENTAPPUSERID uniqueidentifier
)
returns uniqueidentifier
as
begin
  declare @SOURCECODEID uniqueidentifier;

  select top 1 
    @SOURCECODEID = [ID]
  from dbo.[MKTSOURCECODE]
  where [ISDEFAULT] <> 0 
  and [ISACTIVE] <> 0
  and dbo.[UFN_SITEALLOWEDFORUSER](@CURRENTAPPUSERID, [MKTSOURCECODE].[SITEID]) = 1;

  return @SOURCECODEID;
end