Back to OIM Explorer

dbo.QER_FGIITShopFlagCombineValid

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 2.699 characters

Interpretation

  • Database function. Usually supports views, validation, or calculated predicates; look at referenced-by entries for callers.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QBM_FCVObjectkeyToElement source text reference

Complete Source

SQL104 lines
1CREATE FUNCTION dbo.QER_FGIITShopFlagCombineValid(2  @ObjectKeyDestination varchar(138),3  @DestinationIsForITShop BIT,4  @DestinationIsITShopOnly BIT,5  @ObjectKeyElement varchar(138),6  @ElementIsForITShop BIT,7  @ElementIsITShopOnly BIT8) RETURNS BIT9AS10BEGIN11  DECLARE @DestinationTable nvarchar(32)12  DECLARE @ElementTable nvarchar(32)13  DECLARE @msg nvarchar(1000)14  DECLARE @erg BIT = 115  SELECT16    @DestinationTable = dbo.QBM_FCVObjectkeyToElement('TableName',17    @ObjectKeyDestination)18  SELECT19    @ElementTable = dbo.QBM_FCVObjectkeyToElement('TableName',20    @ObjectKeyElement)21  IF @ElementIsForITShop IS NULL OR @ElementIsITShopOnly IS NULL22  BEGIN23    SELECT24      @msg = '#LDS#internal error, irregular null value @ElementIsForITShop.|'25    SELECT @erg = 026    RETURN(@erg)27  END28  IF @ElementIsForITShop = 0 AND @ElementIsITShopOnly = 129  BEGIN30    SELECT31      @msg = '#LDS#Invalid flag combination for IsForITShop and IsITShopOnly. in table {0}.|' + @ElementTable + '|'32    SELECT @erg = 033    RETURN(@erg)34  END35  IF @DestinationTable = 'ESet'36  BEGIN37    IF @DestinationIsForITShop = 0 AND @DestinationIsITShopOnly = 138    BEGIN39      SELECT40        @msg = '#LDS#Invalid flag combination for IsForITShop and IsITShopOnly. in table {0}.|' + @DestinationTable + '|'41      SELECT @erg = 042      RETURN(@erg)43    END44    IF @DestinationIsForITShop = 0 AND @DestinationIsITShopOnly = 045    BEGIN46      IF @ElementIsForITShop = 1 AND @ElementIsITShopOnly = 147      BEGIN48        SELECT49          @msg = '#LDS#Invalid  combination of IT Shop flags from system roles and {0}.|' + @ElementTable + '|'50        SELECT @erg = 051        RETURN(@erg)52      END53    END54    IF @DestinationIsForITShop = 1 AND @DestinationIsITShopOnly = 055    BEGIN56      IF @ElementIsForITShop = 1 AND @ElementIsITShopOnly = 157      BEGIN58        SELECT59          @msg = '#LDS#Invalid  combination of IT Shop flags from system roles and {0}.|' + @ElementTable + '|'60        SELECT @erg = 061        RETURN(@erg)62      END63    END64    IF @DestinationIsForITShop = 1 AND @DestinationIsITShopOnly = 165    BEGIN66      SELECT @msg = '#LDS#Nothing to test.|'67      RETURN(@erg)68    END69  END70  ELSE71  BEGIN72    IF @ElementIsForITShop = 073    BEGIN74      IF @DestinationTable IN('ITShopOrg',75      'ITShopSrc')76      BEGIN77        SELECT78          @msg = '#LDS#IT Shop tables are not allowed as assignment objects if IsForITShop = 0.|'79        SELECT @erg = 080        RETURN(@erg)81      END82    END83    IF @ElementIsForITShop = 1 AND @ElementIsITShopOnly = 084    BEGIN85      SELECT @msg = '#LDS#Nothing to test.|'86      RETURN(@erg)87    END88    IF @ElementIsForITShop = 1 AND @ElementIsITShopOnly = 189    BEGIN90      IF @DestinationTable NOT IN('ITShopOrg',91      'ITShopSrc',92      'MirrorShop')93      BEGIN94        SELECT95          @msg = '#LDS#Target of assignment {0} is not permitted with the combination of flags IsForITShop = 1 and IsITShopOnly = 1.|' + @DestinationTable96          + '|'97        SELECT @erg = 098        RETURN(@erg)99      END100    END101  END102  EndLabel:103  RETURN(@erg)104END
Open raw exported source
SQL ยท Raw18 lines
1      create   function dbo.QER_FGIITShopFlagCombineValid ( @ObjectKeyDestination varchar(138)  ,@DestinationIsForITShop bit  , @DestinationIsITShopOnly2 bit  , @ObjectKeyElement varchar(138)  , @ElementIsForITShop bit  , @ElementIsITShopOnly bit  ) returns bit as begin declare @DestinationTable nvarchar3(32) declare @ElementTable nvarchar(32)  declare @msg nvarchar(1000) declare @erg bit = 1  select @DestinationTable = dbo.QBM_FCVObjectkeyToElement('TableName'4, @ObjectKeyDestination) select @ElementTable = dbo.QBM_FCVObjectkeyToElement('TableName', @ObjectKeyElement)  if @ElementIsForITShop is null or @ElementIsITShopOnly5 is null begin  select @msg = '#LDS#internal error, irregular null value @ElementIsForITShop.|' select @erg = 0  return(@erg)     end   if @ElementIsForITShop6 = 0 and @ElementIsITShopOnly = 1 begin select @msg = '#LDS#Invalid flag combination for IsForITShop and IsITShopOnly. in table {0}.|' + @ElementTable 7+ '|' select @erg = 0  return(@erg)  end if @DestinationTable = 'ESet' begin if @DestinationIsForITShop = 0 and @DestinationIsITShopOnly = 1 begin select8 @msg = '#LDS#Invalid flag combination for IsForITShop and IsITShopOnly. in table {0}.|' + @DestinationTable + '|' select @erg = 0  return(@erg)  end if9 @DestinationIsForITShop = 0 and @DestinationIsITShopOnly = 0 begin if @ElementIsForITShop = 1 and @ElementIsITShopOnly = 1 begin select @msg = '#LDS#Invalid  combination of IT Shop flags from system roles and {0}.|'10 + @ElementTable + '|' select @erg = 0  return(@erg)  end end if @DestinationIsForITShop = 1 and @DestinationIsITShopOnly = 0 begin if @ElementIsForITShop11 = 1 and @ElementIsITShopOnly = 1 begin select @msg = '#LDS#Invalid  combination of IT Shop flags from system roles and {0}.|' + @ElementTable + '|' select12 @erg = 0  return(@erg)  end end if @DestinationIsForITShop = 1 and @DestinationIsITShopOnly = 1 begin select @msg = '#LDS#Nothing to test.|'  return(@erg13)  end end else  begin   if @ElementIsForITShop = 0  begin if @DestinationTable in ('ITShopOrg', 'ITShopSrc')  begin select @msg = '#LDS#IT Shop tables are not allowed as assignment objects if IsForITShop = 0.|'14 select @erg = 0  return(@erg)  end end   if @ElementIsForITShop = 1 and @ElementIsITShopOnly = 0 begin select @msg = '#LDS#Nothing to test.|'  return(@erg15)  end   if @ElementIsForITShop = 1 and @ElementIsITShopOnly = 1 begin  if @DestinationTable not in ('ITShopOrg', 'ITShopSrc', 'MirrorShop') begin select16 @msg = '#LDS#Target of assignment {0} is not permitted with the combination of flags IsForITShop = 1 and IsITShopOnly = 1.|' + @DestinationTable + '|'17 select @erg = 0  return(@erg)  end end  end  EndLabel: return (@erg) end 18