1

This is for SQL Server 2012 Express. Please see the statements below - they are part of a view creation.

SELECT 
    PE.*, ZOTable.DOCNAME AS 'ZO_DOCNAME', SOR.DOCNAME AS 'SoR_DOCNAME'
FROM 
    dbo.TAXPARCEL_EQUALIZER AS PE, 
    dbo.ZONINGORDINANCE AS ZOTable, 
    dbo.SCHEDULEOFREGULATION AS SOR
LEFT JOIN 
    dbo.TAXPARCEL_EQUALIZER AS te1 ON ZOTable.UNIT = te1.UNIT 
LEFT JOIN 
    dbo.TAXPARCEL_EQUALIZER AS te2  ON SOR.ZONECLASS = te2.ZONING1
LEFT JOIN 
    dbo.TAXPARCEL_EQUALIZER AS te3  ON SOR.ZONECLASS = te3.ZONING2

I am getting error

Multipart identifier cannot be bound

on ZOTable.UNIT inside SQL Server Management Studio.

I have looked online but can't find any example to fix mine. If I were to remove the , dbo.SCHEDULEOFREGULATION AS SOR then the error goes away. But then I am not sure how to bring that table into the view?

Thanks!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
IrfanClemson
  • 1,699
  • 6
  • 33
  • 52
  • 4
    **[Why Should You Not to Use Old Style JOIN?](https://blog.sqlauthority.com/2015/10/08/sql-server-why-should-you-not-to-use-old-style-join/)** – Ilyes May 31 '18 at 19:50
  • This is a syntax I found online to combine tables for an Outer Join: All from PE and any matching from ZOTable and SOR. But if there is better syntax then please advise. Thanks. – IrfanClemson May 31 '18 at 19:51
  • Oh, I see you have a link... Thanks – IrfanClemson May 31 '18 at 19:52
  • Thank you. I had seen that link but none of the solution helped me. – IrfanClemson May 31 '18 at 19:56
  • Do you have a column named UNIT in both TAXPARCEL_EQUALIZER and ZONINGORDINANCE? Man those tables are horrible read in all caps. >. – Sean Lange May 31 '18 at 20:08
  • Yes, both have UNIT in them! It's a project assigned to me--cant change db. So whats the fix? Thanks. – IrfanClemson May 31 '18 at 20:10
  • 1
    The fix is getting your query correct. Without some actual details of your tables we are guessing. Here is a good place to start. http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/ I notice you also have aliases as string literals. This has been deprecated for a long time now. Might be a good time to fix that also. https://sqlblog.org/2012/01/23/bad-habits-to-kick-using-as-instead-of-for-column-aliases – Sean Lange May 31 '18 at 20:13
  • None of the Answers in the other links worked. I am trying to join three tables here and the main table (PE) has 6 fields which need to be joined to 6 fields in two different tables. So there is no solution out there which works for me. But this Question has been 'Closed'. – IrfanClemson May 31 '18 at 20:25
  • Then load some table definitions and we can help. But without those details this is unanswerable. Syntactically your query is fine. That means nobody else can reproduce this. If you post those details we can reopen your question. – Sean Lange May 31 '18 at 20:27
  • 1
    As I suspected it is because you are mixing implicit and explicit joins with the very out of date syntax which was pointed out earlier. check this link. https://stackoverflow.com/questions/7314134/the-multi-part-identifier-could-not-be-bound/26459986 Change those implicit cross joins to explicit cross joins and see if that doesn't resolve the issue. – Sean Lange May 31 '18 at 20:33

0 Answers0