GO-ING nowhere

  • jwbart06

    Hall of Fame

    Points: 3291

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

  • Ford Fairlane

    SSCertifiable

    Points: 7664

    INteresting question, thanks for the QotD

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • free_mascot

    One Orange Chip

    Points: 27168

    Interesting question, thanks.

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

  • Koen Verbeeck

    SSC Guru

    Points: 258854

    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

  • twin.devil

    SSC-Insane

    Points: 22208

    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

  • PChiragS

    SSCarpal Tunnel

    Points: 4965

    nice question Joe.

    thanks.

  • timwell

    SSCarpal Tunnel

    Points: 4895

    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.)

  • paul.goldstraw

    SSCrazy

    Points: 2486

    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.

  • sestell1

    SSChampion

    Points: 10230

    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.

  • rfreiberg001

    Mr or Mrs. 500

    Points: 533

    edited

  • SQLRNNR

    SSC Guru

    Points: 281106

    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

  • Arthur Olcot

    SSCertifiable

    Points: 5998

    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]

  • Revenant

    SSC-Forever

    Points: 42468

    I guessed... Thanks, Joe!

  • Ken Wymore

    SSCoach

    Points: 16314

    Nice question. I guessed the second set as well.

  • Hugo Kornelis

    SSC Guru

    Points: 64645

    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 22 total)

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