Insert Statement Syntax Error

  • Hey knowitall, your version did the trick. The code I posted was the SQL view of a query I had in Access. I do have a question about your code.

    On

    "INNER JOIN [pbcsqlclu01\pbcpbs001].[ctsreports].rpt.tbloraclecustomers AS toc1"

    You have "AS" between "rpt.tbloraclecustomers" and "toc1"

    On

    "LEFT JOIN [pbcsqlclu01\pbcpbs001].[ctsreports].rpt.tbloraclecollectors tocoll"

    There is no "AS" between "rpt.tbloraclecollectors" and "tocoll".

    What's the reasoning behind this?

  • guerillaunit (1/23/2012)


    Hey knowitall, your version did the trick. The code I posted was the SQL view of a query I had in Access. I do have a question about your code.

    On

    "INNER JOIN [pbcsqlclu01\pbcpbs001].[ctsreports].rpt.tbloraclecustomers AS toc1"

    You have "AS" between "rpt.tbloraclecustomers" and "toc1"

    On

    "LEFT JOIN [pbcsqlclu01\pbcpbs001].[ctsreports].rpt.tbloraclecollectors tocoll"

    There is no "AS" between "rpt.tbloraclecollectors" and "tocoll".

    What's the reasoning behind this?

    I suppose it is personal preference. The AS is not needed here, but I do not know what is preferred among the more experienced. To me, the AS makes the script clearer. However, I rarely use it and should probably start using it more consistently.

    Jared
    CE - Microsoft

  • Personally I always include the as, and I wish it was mandatory to aid readability.

    Mostly personal preference I suppose regarding the readability side, but I also find for column aliases it avoids any confusion regarding an alias name being used, or a simply a missing comma between expressions in the column list.

    You read code dozens of times more often than you write it, so for 3 characters typing "AS " it is well worth making it easier to read.

    (Just an opinion)

    Mike John

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply