Back to OIM Explorer

dbo.QBM_FGIDBServerCurrStatement

Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB

Scalar Function.

Source: sandbox-db sys.sql_modules

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

Complete Source

SQL24 lines
1CREATE FUNCTION dbo.QBM_FGIDBServerCurrStatement(2  @spid int3) RETURNS nvarchar(max4)5AS6BEGIN7  DECLARE @Erg nvarchar(max)8  IF @spid < 19  BEGIN10    RETURN(@erg)11  END12  SELECT13    TOP 1 @erg = SUBSTRING(qt.TEXT,14    (p.stmt_start/2) +1,15    ((CASE p.stmt_end16    WHEN -1 THEN17    DATALENGTH(qt.TEXT)18  ELSE p.stmt_end19  END - p.stmt_start) /2) +1)20  FROM sys.sysprocesses p CROSS APPLY sys.dm_exec_sql_text(p.sql_handle) qt21  WHERE22    p.spid = @spid endLabel:23  RETURN(@erg)24END
Open raw exported source
SQL ยท Raw4 lines
1  create   function dbo.QBM_FGIDBServerCurrStatement(@spid int  ) returns nvarchar(max)  as begin declare @Erg nvarchar(max) if @spid < 1 begin 2 return(@erg)  end select top 1 @erg = SUBSTRING(qt.TEXT, (p.stmt_start/2)+1, ((CASE p.stmt_end WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE p.stmt_end END - 3p.stmt_start)/2)+1) from sys.sysprocesses p CROSS APPLY sys.dm_exec_sql_text(p.sql_handle) qt where p.spid = @spid endLabel: return(@erg) end 4