dbo.QBM_FCVStringToListSQLMo_int

SQL_TABLE_VALUED_FUNCTION

Created 2026-04-14T23:14:09.917 · modified 2026-04-14T23:14:09.917 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
@SQLInnvarcharno
@CurrentLevelintno
@Checkintno
@withLiteralTopDownbitno

Referenced objects

SchemaObjectColumn/minorClass
QBM_YMorphemInformationTYPE
QBM_YSingleGUIDTYPE
dboQBM_FCVStringToListSQLMo_intOBJECT_OR_COLUMN
dboQBM_FTSQLKeywordsOBJECT_OR_COLUMN

Source excerpt

First extracted SQL definition lines from the exported source. Use the full source page for complete context.

Open full formatted source

1create function dbo.QBM_FCVStringToListSQLMo_int(@SQLIn nvarchar(max) , @CurrentLevel int , @Check int      , @withLiteralTopDown bit ) returns @erg table
2 ( SortOrder int , MorphemType nvarchar(16) collate Database_default , MorphemSubType nvarchar(16) collate Database_default , isConflicted bit default 
30 , CurrentLevel int default 0 , Morphem nvarchar(max) collate Database_default , p1 nvarchar(256) collate Database_default  , p2 nvarchar(256) collate
4 Database_default  , LenMorphem int not null , TargetLine int not null  primary key (SortOrder) ) as begin declare @Element nvarchar(max) declare @i int
5 declare @len int declare @Zustand int declare @Nesting int  declare @NextChar nvarchar(1) declare @Next2Char nvarchar(2)  declare @MaxlenAlias int = 10
6 declare @SourceCode nvarchar(max) select @SourceCode = concat(@sqlIn , nchar(13) , nchar(10)) select @Element = N'' select @len = len(@SourceCode) declare
7 @TargetLine int = 0 declare @LineLength int = 0 declare @LineLengthMax int = 150 declare @result QBM_YMorphemInformation  declare @TwoCharMorphem QBM_YSingleGUID
8 insert into @TwoCharMorphem(UID_SingleGuid )  values ('+=') , ('-=') , ('<>') , ('!=') , ('<=') , ('>=') declare @OneCharMorphem QBM_YSingleGUID insert
9 into @OneCharMorphem(UID_SingleGuid )   Values ( '(') ,(')') ,('=') ,(',') ,(';') ,('+') ,('-') ,('*') ,('/') ,('%') ,('<') ,('>') ,(':') ,('^') ,('!'
10) ,('~') ,('&') ,('|') select @Zustand = 0  select @i = 1 while @i <= @len begin select @Next2Char = substring(@SourceCode , @i, 2) if len(@Next2Char) 
11< 2 begin select @Next2Char = left(concat(@Next2Char , nchar(13) , nchar(10)), 2) end select @NextChar = left(@Next2Char, 1)  if @Zustand = 0  begin if
12 @Next2Char = N'--' begin select @Zustand = 1 select @i += 2 continue end if @Next2Char = N'/*' begin select @Zustand = 2 select @Nesting = 1 select @i
13 += 2 continue end if @Next2Char = N'N''' begin select @Zustand = 3 select @Element += @Next2Char select @i += 2 continue end if @NextChar = N'''' begin
14 select @Zustand = 3 select @Element += @NextChar select @i += 1 continue end if @next2char in (select UID_SingleGuid  from @TwoCharMorphem) begin  insert
15 into @result(Morphemtype, MorphemSubType, morphem, CurrentLevel, LenMorphem, TargetLine) values( 'Morphem' , '2 Chars', @next2char, @CurrentLevel, len
16(@Next2Char), @TargetLine)  select @LineLength += len(@Next2Char) +1 if @LineLength > @LineLengthMax begin select @LineLength = 0 select @TargetLine +=
17 1 end  select @i += 2 select @Zustand = 0 select @element = N''  continue end if @nextChar in (select UID_SingleGuid  from @OneCharMorphem) begin  insert
18 into @result(Morphemtype, MorphemSubType, morphem, CurrentLevel, LenMorphem, TargetLine) values( 'Morphem', '1 Char', @NextChar, @CurrentLevel, len(@NextChar
19), @TargetLine)  select @LineLength += len(@NextChar)+1 if @LineLength > @LineLengthMax begin select @LineLength = 0 select @TargetLine += 1 end  select
20 @i += 1 select @Zustand = 0 select @element = N''  continue end if @NextChar in (N' ', nchar(9)) begin select @Zustand = 4  select @i += 1 continue end
21  if @NextChar = nchar(13) begin  select @i += 1 continue end if @NextChar = nchar(10) begin select @i += 1 continue end  select @Zustand = 5 select @i
22 += 1 select @Element += @NextChar continue end   if @Zustand = 1 begin if @nextchar in ( nchar(13), nchar(10)) begin select @Zustand = 0 continue end 
23select @i += 1 continue end   if @Zustand = 2 begin if @next2char = N'/*' begin select @Nesting += 1 select @i = @i+2 continue end if @next2char = N'*/'
24 begin select @Nesting -= 1 if @nesting = 0 begin select @Zustand = 0 end select @i = @i+2 continue end  select @i += 1 continue end   if @Zustand = 3 
25begin if @Next2Char = N'''''' begin select @Element += @next2char select @i += 2 continue end if @nextchar = N'''' begin select @Zustand = 0 select @i 
26+= 1 select @Element += @nextchar  insert into @result(Morphemtype,MorphemSubType, morphem, CurrentLevel, LenMorphem, TargetLine) values( 'Literal', 'String'
27, @Element, @CurrentLevel, len(@Element), @TargetLine)  select @LineLength += len(@Element)+1 if @LineLength > @LineLengthMax begin select @LineLength 
28= 0 select @TargetLine += 1 end   if @withLiteralTopDown = 1 begin if left(@element, 2) = 'N''' begin select @element = substring(@element, 3,len(@element
29) - 3) end else begin select @element = substring(@element, 2,len(@element) - 2) end select @element = replace(@element, '''''', '''')  insert into @result
30(Morphemtype, MorphemSubType, morphem, CurrentLevel, LenMorphem, TargetLine) select x.Morphemtype, x.MorphemSubType, x.morphem, x.CurrentLevel, len(x.morphem
31), @TargetLine from dbo.QBM_FCVStringToListSQLMo_int (@element , @CurrentLevel + 1, @Check, @withLiteralTopDown) x    end select @element = N'' continue
32 end  select @i += 1 select @Element += @nextchar continue end   if @Zustand = 4 begin if @nextchar in (N' ', nchar(9), nchar(13), nchar(10) ) begin select
33 @i += 1  continue end  select @zustand = 0 continue end   if @zustand = 5 begin if @next2Char in (N'--', N'/*') or @nextchar in (N'''', nchar(10), nchar
34(13), N' ', nchar(9)) or @next2char in (select UID_SingleGuid  from @TwoCharMorphem) or @nextChar in (select UID_SingleGuid  from @OneCharMorphem) begin
35  select @Zustand = 0  insert into @result(Morphemtype, MorphemSubType, morphem, CurrentLevel, LenMorphem, TargetLine) values( 'Morphem', null, @Element
36, @CurrentLevel, len(@element), @TargetLine)  select @LineLength += len(@Element)+1 if @LineLength > @LineLengthMax begin select @LineLength = 0 select
37 @TargetLine += 1 end  select @element = N''  continue end  select @i += 1 select @Element += @nextchar continue end    end  if @Check = -1 begin goto 
38EndLabel end  update @result set p1 = substring(Morphem, 1, PATINDEX(N'%..%', Morphem)-1) , p2 = substring(Morphem, PATINDEX(N'%..%', Morphem)+2, 256) 
39 where morphemtype = 'Morphem' and morphemsubtype is null and PATINDEX(N'%..%', Morphem) > 0 and CurrentLevel = @CurrentLevel update @result set p1 = substring
40(Morphem, 1, PATINDEX(N'%.%', Morphem)-1) , p2 = substring(Morphem, PATINDEX(N'%.%', Morphem)+1, 256)  where morphemtype = 'Morphem' and morphemsubtype
41 is null and p1 is null and PATINDEX(N'%.%', Morphem) > 0 and CurrentLevel = @CurrentLevel  update @result set MorphemType = 'Literal' , MorphemSubType
42 = 'Float' , p1 = null ,p2 = null where morphemtype = 'Morphem' and morphemSubtype is null and isnumeric(p1) = 1 and isnumeric(p2) = 1 and CurrentLevel
43 = @CurrentLevel update @result set morphemType = 'Literal' , MorphemSubtype = 'Int' where morphemtype = 'Morphem' and isnumeric(morphem) = 1 and morphemSubtype
44 is null and CurrentLevel = @CurrentLevel update @result set morphemType = 'Literal' , MorphemSubtype = 'binary' where morphemtype = 'Morphem' and morphem
45 like '0' + 'x%' and morphemSubtype is null and CurrentLevel = @CurrentLevel  update @result set morphemType = 'Variable' , MorphemSubtype = '' where morphemtype
46 = 'Morphem' and left(Morphem, 1) = '@' and substring(Morphem, 2,1) <> '@' and CurrentLevel = @CurrentLevel if @Check = 0 begin goto endLabel end  update
47 @result set Morphemtype = 'KeyWord' , MorphemSubtype = x.KeywordArea from @Result r join dbo.QBM_FTSQLKeywords(1) x on r.MorphemType = 'Morphem' and r.MorphemSubtype
48 is null and r.Morphem = x.Keyword and x.KeywordArea = 'T-SQL' where r.CurrentLevel = @CurrentLevel update @result set Morphemtype = case when x.system_type_id
49 = x.user_type_id then 'SystemObject' else 'SchemaObject' end , MorphemSubtype = 'Type' from @Result r join sys.types x on r.MorphemType = 'Morphem' and
50 r.MorphemSubtype is null and (r.Morphem = x.name or r.p2 = x.name ) where r.CurrentLevel = @CurrentLevel if @Check = 2 begin goto EndLabel end update 
51@result set Morphemtype = 'SchemaObject' , MorphemSubtype = 'Table' from @Result r join sys.tables x with (readpast) on r.MorphemType = 'Morphem' and r.MorphemSubtype
52 is null and (r.Morphem = x.name or r.p2 = x.name ) where r.CurrentLevel = @CurrentLevel  update @result set Morphemtype = 'SchemaObject' , MorphemSubtype
53 = 'Table' from @Result r where r.MorphemType = 'Morphem' and r.MorphemSubtype is null and (r.Morphem like '#%' or r.p2 like '#%' ) and r.CurrentLevel 
54= @CurrentLevel update @result set Morphemtype = 'SchemaObject' , MorphemSubtype = 'View' from @Result r join sys.views x with (readpast) on r.MorphemType
55 = 'Morphem' and r.MorphemSubtype is null and (r.Morphem = x.name or r.p2 = x.name ) where r.CurrentLevel = @CurrentLevel update @result set Morphemtype
56 = 'SchemaObject' , MorphemSubtype = 'TableFunction' from @Result r join sys.objects x with (readpast) on r.MorphemType = 'Morphem' and r.MorphemSubtype
57 is null and (r.Morphem = x.name or r.p2 = x.name ) where x.type in ('IF', 'TF') and r.CurrentLevel = @CurrentLevel update @result set Morphemtype = 'SchemaObject'
58 , MorphemSubtype = 'Function' from @Result r join sys.objects x with (readpast) on r.MorphemType = 'Morphem' and r.MorphemSubtype is null and (r.Morphem
59 = x.name or r.p2 = x.name ) where x.type in ('FN') and r.CurrentLevel = @CurrentLevel update @result set Morphemtype = 'SchemaObject' , MorphemSubtype
60 = 'Procedure' from @Result r join sys.objects x with (readpast) on r.MorphemType = 'Morphem' and r.MorphemSubtype is null and (r.Morphem = x.name or r.p2
61 = x.name ) where x.type in ('P') and r.CurrentLevel = @CurrentLevel  update @result set morphemtype = 'SystemObject' , MorphemSubType = 'Table' where 
62p1 in (select name from sys.schemas with (readpast) ) and p1 <> 'dbo' and p2 > ' ' and CurrentLevel = @CurrentLevel and p2 not like 'sp[_]%'  and morphemtype
63 = 'Morphem' and morphemsubtype is null update @result set morphemtype = 'SystemObject' , MorphemSubType = 'Table' where exists (select top 1 1 from sys.databases
64 sd  where p1 = sd.name collate database_default ) and p2 > ' ' and CurrentLevel = @CurrentLevel and p2 not like 'sp[_]%'  and morphemtype = 'Morphem' 
65and morphemsubtype is null  update @result set MorphemSubtype = 'Table' where MorphemType = 'Variable' and morphem in (select r1.Morphem from @Result r1
66 join @Result r2 on r1.SortOrder + 1 = r2.SortOrder and r1.Morphemtype = 'Variable' and r2.Morphem = 'Table' join @Result r3 on r2.SortOrder + 1 = r3.SortOrder
67 and r3.Morphem = '(' ) and CurrentLevel = @CurrentLevel update @result set Morphemtype = 'ProgramElement' , MorphemSubtype = 'Label' from @Result r join
68 (select * from @result where CurrentLevel = @CurrentLevel) as r2 on r.SortOrder +1 = r2.SortOrder where r.MorphemType = 'Morphem' and r.MorphemSubtype
69 is null and r2.Morphem = ':' and r.CurrentLevel = @CurrentLevel update @result set Morphemtype = 'ProgramElement' , MorphemSubtype = 'Label' from @Result
70 r2 join (select * from @result where CurrentLevel = @CurrentLevel) as r1 on r1.SortOrder +1 = r2.SortOrder where r2.MorphemType = 'Morphem' and r2.MorphemSubtype
71 is null and r1.Morphem = 'Goto' and r2.CurrentLevel = @CurrentLevel   update @result set Morphemtype = r1.Morphemtype , MorphemSubtype = 'TableAlias1'
72 from @Result r2 join (select * from @result where CurrentLevel = @CurrentLevel) as r1 on r1.morphemSubtype in ('Table', 'view', 'TableFunction') and r1.SortOrder
73 + 1 = r2.SortOrder where r2.MorphemType = 'Morphem' and r2.MorphemSubtype is null and len(r2.morphem) <= @MaxlenAlias and r2.p1 is null and r2.CurrentLevel
74 = @CurrentLevel  update @result set Morphemtype = r1.Morphemtype , MorphemSubtype = 'TableAlias2' from @Result r3 join (select * from @result where CurrentLevel
75 = @CurrentLevel) as r1 on r1.morphemSubtype in ('Table', 'view', 'TableFunction') join (select * from @result where CurrentLevel = @CurrentLevel) as r2
76 on r2.Morphem = 'AS' and r1.SortOrder + 1 = r2.SortOrder and r2.SortOrder +1 = r3.SortOrder where r3.MorphemType = 'Morphem' and r3.MorphemSubtype is 
77null and len(r3.morphem) <= @MaxlenAlias and r3.p1 is null and r3.CurrentLevel = @CurrentLevel  update @result set Morphemtype = r1.Morphemtype , MorphemSubtype
78 = 'TableAlias3' from @Result r2 join (select * from @result where CurrentLevel = @CurrentLevel) r1 on r1.morphem = ')' and r1.SortOrder + 1 = r2.SortOrder
79 where r2.MorphemType = 'Morphem' and r2.MorphemSubtype is null and len(r2.morphem) <= @MaxlenAlias and r2.p1 is null and r2.CurrentLevel = @CurrentLevel
80 and r2.morphem <> 'returns'  update @result set Morphemtype = r1.Morphemtype , MorphemSubtype = 'TableAlias4' from @Result r3 join (select * from @result

Module relation graph

Loading module relation graph…

Source-derived context

Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.

provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:14:09.917

None extracted.

Summary: writes INSERT into; reads/joins QBM_FCVStringToListSQLMo_int, QBM_FTSQLKeywords, sys

Declared parameters

ParameterTypeDirection
@SQLInnvarcharinput
@CurrentLevelintinput
@Checkintinput
@withLiteralTopDownbitinput

DML targets

INSERT into

Called routines

None extracted.

Config/session

Config: None extracted.

Session: None extracted.

DBQueue/tasks

None extracted.

Temp tables / referenced variables

Temp: None extracted.

Variables: @SQLIn @CurrentLevel @Check @withLiteralTopDown @erg @Element @i @len @Zustand @Nesting @NextChar @Next2Char @MaxlenAlias @SourceCode @sqlIn @TargetLine @LineLength @LineLengthMax @result @TwoCharMorphem @OneCharMorphem @nesting @next2char @nextchar @element @zustand @next2Char @nextChar @Result

Referenced by / reverse dependencies

Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.

Referencing objectRelationEvidence
dbo.QBM_FCVStringToListSQLMorphemSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_FCVStringToListSQLMorphem0SQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_FCVStringToListSQLMo_intSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QER_FTDynGroupColForImmediateSQL expression dependencydbo · OBJECT_OR_COLUMN
dbo.QBM_FCVStringToListSQLMorphemsource text referenceSQL_INLINE_TABLE_VALUED_FUNCTION
dbo.QBM_FCVStringToListSQLMorphem0source text referenceSQL_INLINE_TABLE_VALUED_FUNCTION
dbo.QBM_FCVStringToListSQLMo_intsource text referenceSQL_TABLE_VALUED_FUNCTION
dbo.QER_FTDynGroupColForImmediatesource text referenceSQL_TABLE_VALUED_FUNCTION