The following is a very shortened version of what I'm trying to do.
I know that SplitString2
works because I tested it with hard coding the string and using ID = 1.
Can someone please try to explain why the last line does not work?
select
xx.ParseThis,
p1.ID, p1.Value,
p2.ID, p2.Value
from
(select
cast('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN' as nvarchar(max)) 'ParseThis') xx
left join
dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1] on p1.ID = 1
left join
dbo.SplitString2(xx.ParseThis, '&') [p2] on p2.ID = 2
I get this error:
Msg 4104, Level 16, State 1, Line 8
The multi-part identifier "xx.ParseThis" could not be bound.