Incorrect syntax near the keyword 'GRANT'

  • Hi All,

    Whats wrong for the below procedure? It is showing the following error "Incorrect syntax near the keyword 'GRANT'"

    If i remove the "GO" statement before the "GRANT" statement it will execute successfully. But if i go and see the Securable

    tab for db_Test Role i am not getting the current procedure.

    Please do needful to correct the procedure. :hehe:

    IF EXISTS(SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[spSample]') AND type IN (N'P', N'PC'))

    DROP PROCEDURE [dbo].[spSample]

    GO

    CREATE PROCEDURE [dbo].[spSample]

    (

    @ErrorMessage nvarchar (1024) OUTPUT

    )

    AS

    BEGIN

    SELECT 1

    END

    GO

    GRANT EXECUTE ON dbo.spSample TO [db_Test]

    GO

  • Just took your code and ran it, works fine...

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Same here

Viewing 3 posts - 1 through 2 (of 2 total)

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