0

This only fails in a subquery on the new server. Alone as a single query it runs fine.

Original code is commented out just a compound set of columns. Now need to string the first three spaces and then the second group of 9 spaces.

FROM   PHOENIX.RingDWStaging.dbo.cSalesBudgetInfo AS cSalesBudgetInfo_1 
  INNER JOIN
             PHOENIX.RingDWStaging.dbo.DimBusinessPartners AS DimBusinessPartners_1 
             ON cSalesBudgetInfo_1.BusinessPartnerID = DimBusinessPartners_1.BusinessPartnerID 
  INNER JOIN dbo.Accounts 
           --ON DimBusinessPartners_1.Division + DimBusinessPartners_1.BusinessPartner = dbo.Accounts.BusinessPartner
             ON DimBusinessPartners_1.Division = LEFT(dbo.Accounts.BusinessPartner, 3) 
             AND DimBusinessPartners_1.BusinessPartner = RIGHT(dbo.Accounts.BusinessPartner, 9) 

This is part of a larger view that is used nightly in data warehouse reporting.

Any idea why? This accounts table is identical in both servers.

Pondlife
  • 15,992
  • 6
  • 37
  • 51
SteveO
  • 477
  • 2
  • 9
  • 17
  • What does "fails" mean? Do you get an error, no results, or wrong results? And you say the query works on its own, but not as a subquery: can you show the actual full query that you're executing? – Pondlife Apr 12 '13 at 16:18
  • Sorry forgot that:Msg 8180, Level 16, State 1, Line 1 Statement(s) could not be prepared. Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "Tbl1007.BusinessPartner" could not be bound. Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "Tbl1007.BusinessPartnerID" could not be bound. Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "Tbl1003.Division" could not be bound. Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "Tbl1001.MTDBudgetAmount" could not be bound. – SteveO Apr 12 '13 at 16:57
  • The subquery is not generating it's schema I believe when that join fails and tosses up all that reference to tables in the query. – SteveO Apr 12 '13 at 17:00
  • Please update your question, it's very difficult to read code or errors in the comments and you should put all the relevant information into the question anyway. And as I said, please include the *full* query, not just part of it. The error messages you posted don't match the query fragment in your question, e.g. where is `MTDBudgetAmount`? – Pondlife Apr 12 '13 at 17:02
  • And [this question](http://stackoverflow.com/questions/14656582/the-multi-part-identifier-could-not-be-bound-subquery) may be helpful – Pondlife Apr 12 '13 at 17:12

0 Answers0