Syntax error in the proximity of GO

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SanDee
    New Member
    • Feb 2007
    • 2

    Syntax error in the proximity of GO

    Hallo zusammen,

    beim Ausführen eines SQL-Scripts mit "GO" als Batchseparator erhalte ich immer die Fehlermeldung "Syntaxfehl er in der Nähe von GO".

    Diese Scripts sind korrekt, denn sie sind schon längere Zeit im Einsatz unter anderen Versionen des SQL Servers und wenn ich die "GO"s entferne, werden sie problemlos ausgeführt.

    Obwohl die Servereinstellu ng schon "GO" als Batchseparator vorsieht, habe ich es nun nochmal explizit im Code gesetzt. Erfolglos...

    Codeauszug:


    myServerConn.Ba tchSeparator = "GO"

    myServerConn.Sq lExecutionModes = Microsoft.SqlSe rver.Management .Common.SqlExec ution Modes.ExecuteAn dCaptureSql

    ServerConn.Exec uteNonQuery(sql )



    Bin ratlos und würde mich über jede Art von Hilfe freuen.
    Danke und liebe Grüße,
    SanDee
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    Hello together, when implementing a SQL Script with "GO" as batch separator I always receive the error message "syntax error in the proximity of GO". This Script is correct, because they are already in the use under other versions of the SQL server and if I remove the "GO"s, they are problem-free. Although the server attitude already plans "GO" as batch separator, I set it now again explicitly in the code. Unsuccessfully. ..
    Code excerpt:
    Code:
    myServerConn.BatchSeparator = "GO" 
    MyServerConn.SqlExecutionModes = Microsoft.SqlServer.Management.Common.SqlExecution Modes.ExecuteAndCaptureSql 
    ServerConn.ExecuteNonQuery(sql)
    Are helpless and any kind of assistance would be pleased. Thanks and, SanDee greetings everyone.



    -------------------------------- iam_clint ---------------------------------
    Used a translator to get this over to english incase no one knows german.


    Ich übersetzte Ihren Pfosten, also konnten andere ihn lesen. Willkommen zu TheScripts.

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      Thanks for translation… :)
      Sorry, without seeing syntax itself not sure how to help... :(

      Go should be on a new line and no spaces in front of it.

      It could happen when script was restored from a previous version of SQL and didn't give you a problem until you recompiled it or something made script to be recompiled and new compiler reacted to it differently.

      Comment

      • SanDee
        New Member
        • Feb 2007
        • 2

        #4
        Hi there,

        I'm sorry for writing my post in German. I posted it on different german message boards and didn't recognize the language here is English although I searched the postings here for a similar problem! Sometimes I'm really absent-minded like an odd Professor... ;o)

        Thank you very much for your translation and the time you spent for that.
        Have a nice day,
        Sandra


        Originally posted by iam_clint
        Hello together, when implementing a SQL Script with "GO" as batch separator I always receive the error message "syntax error in the proximity of GO". This Script is correct, because they are already in the use under other versions of the SQL server and if I remove the "GO"s, they are problem-free. Although the server attitude already plans "GO" as batch separator, I set it now again explicitly in the code. Unsuccessfully. ..
        Code excerpt:
        Code:
        myServerConn.BatchSeparator = "GO" 
        MyServerConn.SqlExecutionModes = Microsoft.SqlServer.Management.Common.SqlExecution Modes.ExecuteAndCaptureSql 
        ServerConn.ExecuteNonQuery(sql)
        Are helpless and any kind of assistance would be pleased. Thanks and, SanDee greetings everyone.



        -------------------------------- iam_clint ---------------------------------
        Used a translator to get this over to english incase no one knows german.


        Ich übersetzte Ihren Pfosten, also konnten andere ihn lesen. Willkommen zu TheScripts.

        Comment

        Working...