Back to OIM Explorer

dbo.QBM_FGIModuleIsToUpdate

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 861 characters

Interpretation

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

Relations

  • No extracted relations.

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

  • No direct source references extracted.

Complete Source

SQL44 lines
1CREATE FUNCTION dbo.QBM_FGIModuleIsToUpdate(2  @ModuleName varchar(3),3  @TargetVersion varchar(64)4) RETURNS BIT5AS6BEGIN7  DECLARE @erg BIT = 08  DECLARE @CurrentModuleOwner varchar(3)9  IF NOT EXISTS(10    SELECT TOP 1 111    FROM sys.objects t12    WITH(readpast)13  WHERE14    t.name = 'DialogDatabase' AND t.type = 'U')15  BEGIN16    GOTO endLabel17  END18  IF EXISTS(19    SELECT TOP 1 120    FROM QBMModuleDef d21    WITH(readpast)22  WHERE23    d.UID_ModuleDef = CONCAT(@ModuleName, '-Moduledefinition') AND isnull(d.MigrationVersion, '') < @TargetVersion AND d.MigrationVersion >24  ' ')25  BEGIN26    SELECT @erg = 127    SELECT TOP 1 @CurrentModuleOwner = d.ModuleOwner28    FROM DialogDatabase d29      WITH(readpast)30    WHERE31      d.IsMainDatabase = 132    IF isnull(@CurrentModuleOwner,33    '') = ''34    BEGIN35      SELECT @CurrentModuleOwner = ''36    END37    IF @CurrentModuleOwner = @ModuleName38    BEGIN39      SELECT @erg = 040    END41  END42  endLabel:43  RETURN(@erg)44END
Open raw exported source
SQL ยท Raw7 lines
1  create   function dbo.QBM_FGIModuleIsToUpdate (@ModuleName varchar(3) , @TargetVersion varchar(64) ) returns bit as begin declare @erg bit = 02 declare @CurrentModuleOwner varchar(3) if not exists (select top 1 1 from sys.objects t with (readpast) where t.name = 'DialogDatabase' and t.type = 'U'3 ) begin goto endLabel end if exists (select top 1 1 from QBMModuleDef d with (readpast) where d.UID_ModuleDef = concat(@ModuleName , '-Moduledefinition'4) and isnull(d.MigrationVersion, '') < @TargetVersion  and d.MigrationVersion > ' ' ) begin select @erg = 1 select top 1 @CurrentModuleOwner = d.ModuleOwner5 from DialogDatabase d with (readpast) where d.IsMainDatabase = 1 if isnull(@CurrentModuleOwner, '') = '' begin select @CurrentModuleOwner = '' end if 6@CurrentModuleOwner = @ModuleName  begin select @erg = 0 end end endLabel: return(@erg) end 7