GO-ING nowhere

  • Comments posted to this topic are about the item GO-ING nowhere

  • INteresting question, thanks for the QotD

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Interesting question, thanks.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • Interesting question.

    Always nice to see how Microsoft differs from other vendors (or how other vendors differ from Microsoft :-D) when it comes to terminating a simple line.

    Always nice when you need to read flat files generated on a UNIX system into SQL Server... 🙂

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (4/8/2014)


    Interesting question.

    Always nice to see how Microsoft differs from other vendors (or how other vendors differ from Microsoft :-D) when it comes to terminating a simple line.

    Always nice when you need to read flat files generated on a UNIX system into SQL Server... 🙂

    +1

  • nice question Joe.

    thanks.

  • For both versions I got this:

    Msg 102, Level 15, State 1, Line 26

    Incorrect syntax near 'GO'.

    "None of the above" was not an option so I knew something was off...

    Did anyone else get that? I am using 2008 R2 (and changed the names to tables and fields in my test data.)

  • Also if I paste either result into Notepad GO is on the same line. I had a feeling this would happen, but had no idea the engine wouldn't care for one, but would for the other.

  • timwell (4/9/2014)


    For both versions I got this:

    Msg 102, Level 15, State 1, Line 26

    Incorrect syntax near 'GO'.

    "None of the above" was not an option so I knew something was off...

    Did anyone else get that? I am using 2008 R2 (and changed the names to tables and fields in my test data.)

    Same here. The SSMS results window seems to convert both CR and LF to a space.

  • edited

  • sestell1 (4/9/2014)


    timwell (4/9/2014)


    For both versions I got this:

    Msg 102, Level 15, State 1, Line 26

    Incorrect syntax near 'GO'.

    "None of the above" was not an option so I knew something was off...

    Did anyone else get that? I am using 2008 R2 (and changed the names to tables and fields in my test data.)

    Same here. The SSMS results window seems to convert both CR and LF to a space.

    For it to work properly you need to choose to have the results go to text rather than grid in SSMS. Then there is only one correct answer.

    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

  • Interesting question. Although I feel that if you need to have line feeds/carriage returns in the dynamic SQL that you are constructing, I find it better to incorporate that into the script. And it makes it a bit easier to read.. E.g.

    SELECT TOP 10 'DELETE FROM [AdventureWorks2012].[Person].[BusinessEntityAddress]

    WHERE [BusinessEntityID]='+CAST([BusinessEntityID] AS VARCHAR(50))+ '

    GO'

    FROM [AdventureWorks2012].[Person].[BusinessEntityAddress]

  • I guessed... Thanks, Joe!

  • Nice question. I guessed the second set as well.

  • Just for the record - GO is not a statement, it is a batch separator. It will be intercepted and handled by the client. Send a "GO" to SQL Server, and you'll get an error.

    Proof: EXEC ('GO');


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

Viewing 15 posts - 1 through 15 (of 21 total)

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