Back to OIM Explorer

dbo.QBM_FGIGuidIsValid

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 1.411 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_FGIDBOwner source text reference
  • references source dbo.QBM_FGIModuleExists source text reference

Complete Source

SQL82 lines
1CREATE FUNCTION dbo.QBM_FGIGuidIsValid(2  @Guid varchar(38)3) RETURNS int4AS5BEGIN6  DECLARE @erg int = 07  IF len(@guid) < 68  BEGIN9    RETURN(@erg)10  END11  DECLARE @patH nvarchar(256) = '[0-F]'12  DECLARE @PatA nvarchar(256) = '[a-z]'13  DECLARE @patN nvarchar(256) = '[0-Z]'14  DECLARE @ModuleOwner varchar(3)15  DECLARE @ModuleInGuid varchar(3)16  IF @Guid LIKE CONCAT(replicate(@path, 8),17  replicate(CONCAT('-', replicate(@patH, 4)), 3),18  '-',19  replicate(@path, 12))20  BEGIN21    SELECT @erg = 122    RETURN(@erg)23  END24  IF Len(@Guid) = 3825  BEGIN26    IF @Guid LIKE 'XX' + CONCAT(replicate(@path, 8),27    replicate(CONCAT('-', replicate(@patH, 4)), 3),28    '-',29    replicate(@path, 12))30    BEGIN31      SELECT @erg = 132      RETURN(@erg)33    END34  END35  IF @Guid LIKE CONCAT(@patA,36  @patN,37  @PatN,38  '-%')39  BEGIN40    SELECT @erg += 341  END42  IF @Guid LIKE CONCAT(@patA,43  @patN,44  @PatN,45  '-',46  replicate(@path, 32))47  BEGIN48    SELECT @erg += 449  END50  ELSE51  BEGIN52    IF @Guid NOT LIKE CONCAT(@patA,53    @patN,54    @PatN,55    '-',56    @patA,57    replicate('[0-9,a-z,-]', len(@Guid) - 5))58    BEGIN59      SELECT @erg = 060      RETURN(@erg)61    END62  END63  SELECT @ModuleInGuid =64  LEFT(@guid,65  3)66  IF @ModuleInGuid NOT IN('ZZZ',67  'XXX')68  BEGIN69    IF dbo.QBM_FGIModuleExists('HDB') = 0 AND dbo.QBM_FGIModuleExists(@ModuleInGuid) = 070    BEGIN71      SELECT @erg = 072      RETURN(@erg)73    END74  END75  SELECT TOP 1 @ModuleOwner = dbo.QBM_FGIDBOwner()76  IF @ModuleInGuid = @ModuleOwner77  BEGIN78    SELECT @erg += 879  END80  endLabel:81  RETURN(@erg)82END
Open raw exported source
SQL ยท Raw11 lines
1  create   function dbo.QBM_FGIGuidIsValid(@Guid varchar(38) ) returns int as begin declare @erg int = 0   if len(@guid) < 6 begin  return(@erg)2  end declare @patH nvarchar(256) = '[0-F]'  declare @PatA nvarchar(256) = '[a-z]' declare @patN nvarchar(256) = '[0-Z]'   declare @ModuleOwner varchar3(3)  declare @ModuleInGuid varchar(3)  if @Guid like  concat(replicate(@path,8) , replicate( concat('-' , replicate(@patH,4)) ,3) , '-' , replicate(@path4, 12) ) begin select @erg = 1  return(@erg)  end if Len(@Guid) = 38 begin if @Guid like 'XX' + concat(replicate(@path,8) , replicate( concat('-' , replicate5(@patH,4)) ,3) , '-' , replicate(@path, 12) ) begin select @erg = 1  return(@erg)  end end  if @Guid like concat(@patA , @patN , @PatN , '-%') begin select6 @erg += 3 end if @Guid like  concat(@patA , @patN , @PatN , '-' , replicate(@path, 32)) begin select @erg += 4 end else begin   if @Guid not like  concat7(@patA , @patN , @PatN , '-' , @patA , replicate('[0-9,a-z,-]', len(@Guid) - 5)) begin select @erg = 0  return(@erg)  end end select @ModuleInGuid = LEFT8(@guid, 3) if @ModuleInGuid not in ('ZZZ' , 'XXX' )  begin  if dbo.QBM_FGIModuleExists('HDB') = 0 and dbo.QBM_FGIModuleExists(@ModuleInGuid) = 0 begin 9select @erg = 0  return(@erg)  end end select top 1 @ModuleOwner = dbo.QBM_FGIDBOwner() if @ModuleInGuid = @ModuleOwner begin select @erg += 8 end endLabel:10 return(@erg) end 11