Canned query suddenly stopped working

  • The script we run in the SQL query analyzer to roll over the month in our SQL 2000 database is no longer working. We are getting a syntax error. The odd part is that it is the same text we use and have used every month for years. All we do is copy it from a text file and paste it into the query analyzer. Any ideas would be helpful.

    Server: Msg 170, Level 15, State 1, Line 12

    Line 12: Incorrect syntax near '6'.

    (that's 6 = receipts)

    select * from trans where hmy = 600147356

    update trans set upostdate ='07/01/04' where hmy = 600147356

    update trans set sdateoccurred = '07/01/04' where hmy = 600147356

    update trans set sotherdate1 = '08/31/02' where hmy = 1000000015

    update trans set sdatecreated = '12/27/03' where hmy = 600111133

    delete from trans where hmy = 1800000039

    6 = receipts

    7 = charges

    3 = payables

    2 = checks

    10= journal entry

    upostdate = Post Month

    sdateoccurred = Transaction Date

  • I'm sure this sproc did never run before since the syntax is incorrect.

    My guess would be that the lower part of the query (starting with "6 = receipts") usually is commented out and is used as alternative WHERE conditions (assuming those columns really exist).

    Another option could be that the code snippet got copied into a query window with already existing code... (or that scenario happened before and the query has been saved to file like that)...



    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]

  • I would lean to those lines of code should be commented out. They are not proper SQL syntax.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 3 posts - 1 through 2 (of 2 total)

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