locked
What is the use of GRANT EXECUTE? RRS feed

  • Question

  • what is the use of GRANT EXECUTE in terms of stored procedure?
    Ashish Fugat (9960978134) Software Engineer
    Thursday, November 24, 2011 1:53 PM

Answers

  • Allowing user to EXECUTE the stored procedure even not being a owner/permission to deal with underlying tables (that use by this sp) --exception dynamic sql 


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Proposed as answer by Naomi N Thursday, November 24, 2011 4:37 PM
    • Marked as answer by Kalman Toth Tuesday, November 29, 2011 6:14 AM
    Thursday, November 24, 2011 1:57 PM
    Answerer
  • GRANT EXECUTE ON SP_Name TO [USER_NAME];

    GO

    Through above script user can able to execute the Stored Procedure.

    For example if you want to give an Execute access to run SP_Who2 for any particular user then he/she can able to run the SP_Who2 or else it will through an error like "you doesn't have permission to execute..."

     

     


    Nareshkar Pakanati 

    MCTS, MCITP SQL Server 2008 Admin
    My Blog: www.mssqlfix.com
    Twitter: @mssqlfix
    -------------------------------------------------------
    Please mark the post as Answered if it answers your question.
    -------------------------------------------------------
    • Proposed as answer by Naomi N Thursday, November 24, 2011 4:37 PM
    • Marked as answer by Kalman Toth Tuesday, November 29, 2011 6:14 AM
    Thursday, November 24, 2011 2:54 PM

All replies

  • Allowing user to EXECUTE the stored procedure even not being a owner/permission to deal with underlying tables (that use by this sp) --exception dynamic sql 


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Proposed as answer by Naomi N Thursday, November 24, 2011 4:37 PM
    • Marked as answer by Kalman Toth Tuesday, November 29, 2011 6:14 AM
    Thursday, November 24, 2011 1:57 PM
    Answerer
  • GRANT EXECUTE ON SP_Name TO [USER_NAME];

    GO

    Through above script user can able to execute the Stored Procedure.

    For example if you want to give an Execute access to run SP_Who2 for any particular user then he/she can able to run the SP_Who2 or else it will through an error like "you doesn't have permission to execute..."

     

     


    Nareshkar Pakanati 

    MCTS, MCITP SQL Server 2008 Admin
    My Blog: www.mssqlfix.com
    Twitter: @mssqlfix
    -------------------------------------------------------
    Please mark the post as Answered if it answers your question.
    -------------------------------------------------------
    • Proposed as answer by Naomi N Thursday, November 24, 2011 4:37 PM
    • Marked as answer by Kalman Toth Tuesday, November 29, 2011 6:14 AM
    Thursday, November 24, 2011 2:54 PM