go command

  • DELETE FROM emp

    WHERE job = 'clerk';

    go

    i m getting som erros.i read alomst 10 to 15 of articles on go command still i m not able to get it.i m trying all the possible stuffs with it.but all the time i get some error.

    help me out pls

    thanks in advance

    jay thakkar,student,india

  • It's simply a batch delimiter. It tells the client tool where to break apart batches to send to SQL. It is not actually a SQL command.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • What are the error messages you get? The query itself looks fine...

    There can be anything like permission issues, mis-spelled table or column name, data type conflict, foreign key references - just to name a few.



    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 kno "go" isnt a part of t-sql.

    but the statement i wrote shld get executed.

    it isnt.why??

    if i remove "go" it works fine

    why???

  • go only works in ssms is that true??

    if i execute the same query in query editor of ssms it works fine.

  • you have to use either ";" or "GO"

    but not both of them.

    both are batch separator

  • ; --> statement delemeter or terminator

    GO --> batch terminator.

    i read somewhere.

  • sanjays-735734 (10/25/2010)


    you have to use either ";" or "GO"

    but not both of them.

    both are batch separator

    That is not true.

    The ; is a statement delimiter. It shows where the end of the statement is. GO breaks apart batches.

    Easy to demonstrate. The first example works, the second does not.

    DECLARE @i int;

    SET @i = 1;

    SELECT @i;

    DECLARE @i int

    GO

    SET @i = 1

    GO

    SELECT @i

    GO

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • jay.supersaiyan (10/25/2010)


    i kno "go" isnt a part of t-sql.

    but the statement i wrote shld get executed.

    it isnt.why??

    if i remove "go" it works fine

    why???

    No idea. It looks fine.

    What's the error you're getting? Is that the entire script?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • now its working fine i guess.i read some where that go command will only work in query editor of ssms.

    so statements

    use employeedb;

    go

    select * from emp;

    go

    are working fine till now.

    jay thakkar,student,india

  • You still haven't provided any of the error messages you mentioned. Please post those errors.



    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]

  • it was "incorrect syntex error near go".now its working fine..

    i was using a query editor on which go dosnt work.

  • Which editor? As an FYI for me.

Viewing 13 posts - 1 through 12 (of 12 total)

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