Msg 4104, Level 16, State 1, Line 8 The multi-part identifier “xx.ParseThis” could not be bound












1















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.











share|improve this question





























    1















    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.











    share|improve this question



























      1












      1








      1








      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.











      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 5:24









      marc_s

      578k12911161262




      578k12911161262










      asked Nov 14 '18 at 23:06









      cmgcmg

      82




      82
























          3 Answers
          3






          active

          oldest

          votes


















          0














          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]





          share|improve this answer


























          • Thank You Martin.

            – cmg
            Nov 16 '18 at 15:13



















          -1














          I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination






          share|improve this answer































            -1














            Put a second literal string as like this



               NURN' as nvarchar(max)) as 'ParseThis' 


            Try with and without quotes around the ParseThis FieldName






            share|improve this answer























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              0














              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]





              share|improve this answer


























              • Thank You Martin.

                – cmg
                Nov 16 '18 at 15:13
















              0














              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]





              share|improve this answer


























              • Thank You Martin.

                – cmg
                Nov 16 '18 at 15:13














              0












              0








              0







              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]





              share|improve this answer















              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]






              share|improve this answer














              share|improve this answer



              share|improve this answer








              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



















              • 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













              -1














              I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination






              share|improve this answer




























                -1














                I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination






                share|improve this answer


























                  -1












                  -1








                  -1







                  I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination






                  share|improve this answer













                  I believe its because your query can not find "xx.ParseThis" inside your "From" selection / destination







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 14 '18 at 23:32









                  RaniduRanidu

                  192




                  192























                      -1














                      Put a second literal string as like this



                         NURN' as nvarchar(max)) as 'ParseThis' 


                      Try with and without quotes around the ParseThis FieldName






                      share|improve this answer




























                        -1














                        Put a second literal string as like this



                           NURN' as nvarchar(max)) as 'ParseThis' 


                        Try with and without quotes around the ParseThis FieldName






                        share|improve this answer


























                          -1












                          -1








                          -1







                          Put a second literal string as like this



                             NURN' as nvarchar(max)) as 'ParseThis' 


                          Try with and without quotes around the ParseThis FieldName






                          share|improve this answer













                          Put a second literal string as like this



                             NURN' as nvarchar(max)) as 'ParseThis' 


                          Try with and without quotes around the ParseThis FieldName







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 15 '18 at 0:12









                          Sql SurferSql Surfer

                          735416




                          735416






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Xamarin.iOS Cant Deploy on Iphone

                              Glorious Revolution

                              Dulmage-Mendelsohn matrix decomposition in Python