dbo.QBM_FCV0C695385CB1124DCEA40A_
Scalar FunctionSQL_SCALAR_FUNCTIONSandbox DB
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
1CREATE FUNCTION dbo.QBM_FCV0C695385CB1124DCEA40A_(2 @TableName varchar(30)3) RETURNS varchar(304)5AS6BEGIN7 DECLARE @TableNameIntern varchar(30) = NULL8 DECLARE @AccessKey nvarchar(128) = N 'RTCTN' + upper(@TableName)9 DECLARE @ContextValue varchar(30) = convert(varchar(30),10 SESSION_CONTEXT(@AccessKey))11 IF @ContextValue IS NULL12 BEGIN13 SELECT TOP 1 @TableNameIntern = t.TableName14 FROM DialogTable t15 WHERE16 t.TableName = @TableName17 IF @TableNameIntern IS NULL18 BEGIN19 SELECT TOP 1 @TableNameIntern = table_name20 FROM information_schema.tables21 WHERE22 table_name = @TableName23 IF @TableNameIntern IS NULL24 BEGIN25 SELECT @TableNameIntern = @TableName26 END27 ELSE28 BEGIN29 EXEC sp_set_session_context @key = @AccessKey,30 @value = @TableNameIntern31 END32 END33 ELSE34 BEGIN35 EXEC sp_set_session_context @key = @AccessKey,36 @value = @TableNameIntern37 END38 END39 ELSE40 BEGIN41 SELECT @TableNameIntern = @ContextValue42 END43 RETURN(@TableNameIntern)44END
Open raw exported source
1 create function dbo.QBM_FCV0C695385CB1124DCEA40A_ (@TableName varchar(30) ) returns varchar(30) as begin declare @TableNameIntern varchar2(30) = null declare @AccessKey nvarchar(128) = N'RTCTN' + upper(@TableName) declare @ContextValue varchar(30) = convert(varchar(30), SESSION_CONTEXT(@AccessKey3)) if @ContextValue is null begin select top 1 @TableNameIntern = t.TableName from DialogTable t where t.TableName = @TableName if @TableNameIntern is 4null begin select top 1 @TableNameIntern = table_name from information_schema.tables where table_name = @TableName if @TableNameIntern is null begin select5 @TableNameIntern = @TableName end else begin exec sp_set_session_context @key = @AccessKey, @value = @TableNameIntern end end else begin exec sp_set_session_context6 @key = @AccessKey, @value = @TableNameIntern end end else begin select @TableNameIntern = @ContextValue end return (@TableNameIntern) end 7