Msg 4104, Level 16, State 1, Line 8 The multi-part identifier “xx.ParseThis” could not be bound
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.
sql-server ssms
add a comment |
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.
sql-server ssms
add a comment |
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.
sql-server ssms
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.
sql-server ssms
sql-server ssms
edited Nov 15 '18 at 5:24
marc_s
578k12911161262
578k12911161262
asked Nov 14 '18 at 23:06
cmgcmg
82
82
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You are trying to join onto the expression dbo.SplitString2(xx.ParseThis, '&')
The contents of the table returned by that will vary row by row dependant on the value of xx.ParseThis
.
The definition of tables involved in a join can not be correlated based on values from other tables (and it does not matter that in this case your example only has one row.)
For that you would need APPLY
.
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)) AS ParseThis) xx
LEFT JOIN dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1]
ON p1.ID = 1
OUTER APPLY (SELECT *
FROM dbo.SplitString2(xx.ParseThis, '&') [p2]
WHERE p2.ID = 2) [p2]
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
add a comment |
I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination
add a comment |
Put a second literal string as like this
NURN' as nvarchar(max)) as 'ParseThis'
Try with and without quotes around the ParseThis FieldName
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310080%2fmsg-4104-level-16-state-1-line-8-the-multi-part-identifier-xx-parsethis-cou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are trying to join onto the expression dbo.SplitString2(xx.ParseThis, '&')
The contents of the table returned by that will vary row by row dependant on the value of xx.ParseThis
.
The definition of tables involved in a join can not be correlated based on values from other tables (and it does not matter that in this case your example only has one row.)
For that you would need APPLY
.
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)) AS ParseThis) xx
LEFT JOIN dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1]
ON p1.ID = 1
OUTER APPLY (SELECT *
FROM dbo.SplitString2(xx.ParseThis, '&') [p2]
WHERE p2.ID = 2) [p2]
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
add a comment |
You are trying to join onto the expression dbo.SplitString2(xx.ParseThis, '&')
The contents of the table returned by that will vary row by row dependant on the value of xx.ParseThis
.
The definition of tables involved in a join can not be correlated based on values from other tables (and it does not matter that in this case your example only has one row.)
For that you would need APPLY
.
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)) AS ParseThis) xx
LEFT JOIN dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1]
ON p1.ID = 1
OUTER APPLY (SELECT *
FROM dbo.SplitString2(xx.ParseThis, '&') [p2]
WHERE p2.ID = 2) [p2]
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
add a comment |
You are trying to join onto the expression dbo.SplitString2(xx.ParseThis, '&')
The contents of the table returned by that will vary row by row dependant on the value of xx.ParseThis
.
The definition of tables involved in a join can not be correlated based on values from other tables (and it does not matter that in this case your example only has one row.)
For that you would need APPLY
.
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)) AS ParseThis) xx
LEFT JOIN dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1]
ON p1.ID = 1
OUTER APPLY (SELECT *
FROM dbo.SplitString2(xx.ParseThis, '&') [p2]
WHERE p2.ID = 2) [p2]
You are trying to join onto the expression dbo.SplitString2(xx.ParseThis, '&')
The contents of the table returned by that will vary row by row dependant on the value of xx.ParseThis
.
The definition of tables involved in a join can not be correlated based on values from other tables (and it does not matter that in this case your example only has one row.)
For that you would need APPLY
.
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)) AS ParseThis) xx
LEFT JOIN dbo.SplitString2('Term1=2018FA&Term2=2019SP&EndDate=04/02/2019&Major=NURN', '&') [p1]
ON p1.ID = 1
OUTER APPLY (SELECT *
FROM dbo.SplitString2(xx.ParseThis, '&') [p2]
WHERE p2.ID = 2) [p2]
edited Nov 15 '18 at 9:19
answered Nov 15 '18 at 9:01
Martin SmithMartin Smith
347k59582690
347k59582690
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
add a comment |
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
Thank You Martin.
– cmg
Nov 16 '18 at 15:13
add a comment |
I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination
add a comment |
I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination
add a comment |
I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination
I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination
answered Nov 14 '18 at 23:32
RaniduRanidu
192
192
add a comment |
add a comment |
Put a second literal string as like this
NURN' as nvarchar(max)) as 'ParseThis'
Try with and without quotes around the ParseThis FieldName
add a comment |
Put a second literal string as like this
NURN' as nvarchar(max)) as 'ParseThis'
Try with and without quotes around the ParseThis FieldName
add a comment |
Put a second literal string as like this
NURN' as nvarchar(max)) as 'ParseThis'
Try with and without quotes around the ParseThis FieldName
Put a second literal string as like this
NURN' as nvarchar(max)) as 'ParseThis'
Try with and without quotes around the ParseThis FieldName
answered Nov 15 '18 at 0:12
Sql SurferSql Surfer
735416
735416
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310080%2fmsg-4104-level-16-state-1-line-8-the-multi-part-identifier-xx-parsethis-cou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown