Tag: permission to read procedure text

  • Msg 15009, Level 16, State 1, Procedure sp_help, sp_helptext or object_definition()

    Whenever user has in-sufficient permission and he is executing sp_help, sp_helptext or the object_definition function, user will get the below error message. This error occurs because user doesn’t have have permissions to the see the object metadata.

    EXEC sp_helptext sp_indexdefrag
    Msg 15009, Level 16, State 1, Procedure sp_helptext

    To fix the issue we have to grant the VIEW DEFINITION permission to user.
    We can turn on the View Definition permission on all databases for all the users having public role using below code.

    USE master
    GO
    GRANT VIEW ANY DEFINITION TO PUBLIC

    We can turn on the View Definition permission on all databases for the user Jugal using below query.

    USE master
    GO
    GRANT VIEW ANY DEFINITION TO Jugal

    We can turn on the View Definition permission on SQLDBPOOL for the user Jugal using below query.

    USE SQLDBPOOL
    GO
    GRANT VIEW DEFINITION TO Jugal