Incorrect Syntax error, but nothing is wrong?

  • Here are my final 2 lines of code and the resulting error:

    SELECT * FROM #tblTrackPoints

    DROP TABLE #tblTrackPoints

    Msg 102, Level 15, State 1, Line 252

    Incorrect syntax near '#tblTrackPoints'.

    If I remove the DROP TABLE line, the error would be on line 251. Any ideas? This was working last night and I don't know what changed...

  • Shortened it up a little bit, but still getting an error on the last line - no matter what is on that line. Here is a link to the code as a TXT file.

    http://www.usabmx.com/pdf/TrackPointsSQL.txt

  • Need to see the whole procedure.

  • brad 51473 (4/19/2014)


    Shortened it up a little bit, but still getting an error on the last line - no matter what is on that line. Here is a link to the code as a TXT file.

    http://www.usabmx.com/pdf/TrackPointsSQL.txt

    Not going to a site I know nothing about to look at the code.

  • Taking aside the fact that there isn't even a DROP TABLE statement in the code you referenced as well as the nested c.u.r.s.o.r. *cough* in there, the reason for the error message seems to be a missing END leading to an incomplete code block.

    Check each code section for correct BEGIN and END statements.

    And while you're at it: rethink that code to be set oriented instead of dealing with one row at the time...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

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