• Lokesh Vij (3/6/2013)


    Danny Ocean (3/6/2013)


    If you check msdn, then you will find that every create store procedure and create function, always contains a "GO" statement before the definition.

    Danny, I did not get you. Please elaborate.

    Thanks!

    Lokesh, If you check below links then you will find that before creating store procedure and function there is a "GO" keyword.

    GO is used to separate two batches.

    Check below two examples. Example 1 generate an error like 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch. But example 2 executes successfully.

    ---- Example 1

    select 1

    Create proc Test

    AS

    select 2

    GO

    ---- Example 2

    select 1

    GO

    Create proc Test

    AS

    select 2

    http://msdn.microsoft.com/en-us/library/ms187926(v=sql.100).aspx

    http://msdn.microsoft.com/en-us/library/ms186755.aspx

    I hope this will help you. 🙂

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!