Back to OIM Explorer

dbo.QBM_FGISQLCodeExistsInSchema

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

Source size: 705 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

SQL34 lines
1CREATE FUNCTION dbo.QBM_FGISQLCodeExistsInSchema(2  @CodeName varchar(30),3  @code nvarchar(max)4) RETURNS int5AS6BEGIN7  DECLARE @erg int = 08  IF EXISTS(9    SELECT TOP 1 110    FROM sys.objects p11    JOIN sys.sql_modules q12      ON p.object_id = q.object_id13    WHERE14      p.name = @CodeName AND substring(q.definition, 7, LEN(q.definition) -6) = substring(@code, 7, LEN(@code) -6) collate SQL_Latin1_General_CP1_CS_AS AND15  LEFT(q.definition, 6) =16  LEFT(@code, 6))17  BEGIN18    SELECT @erg = 119    RETURN(@erg)20  END21  IF EXISTS(22    SELECT TOP 1 123    FROM sys.objects p24    JOIN sys.sql_modules q25      ON p.object_id = q.object_id26    WHERE27      p.name = @CodeName AND q.definition > ' ')28  BEGIN29    SELECT @erg = -130    RETURN(@erg)31  END32  endLabel:33  RETURN(@erg)34END
Open raw exported source
SQL ยท Raw6 lines
1  create   function dbo.QBM_FGISQLCodeExistsInSchema(@CodeName varchar(30) , @code nvarchar(max) ) returns int  as begin declare @erg int = 0 if2 exists (select top 1 1 from sys.objects p join sys.sql_modules q on p.object_id = q.object_id where p.name = @CodeName and substring(q.definition, 7, 3LEN(q.definition)-6 ) = substring(@code, 7, LEN(@code) -6) collate SQL_Latin1_General_CP1_CS_AS  and LEFT(q.definition, 6) = LEFT(@code, 6) ) begin select4 @erg = 1  return(@erg)  end if exists (select top 1 1 from sys.objects p join sys.sql_modules q on p.object_id = q.object_id where p.name = @CodeName 5and q.definition > ' ' ) begin select @erg = -1  return(@erg)  end endLabel: return (@erg) end 6