• 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