The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'

  • Hi,

    We have recently deployed a database through Visual studio team suit.while building the database built script through Visual studio it gaves an warning that one of our stored procedure uses system stored procedure "SP_Send_DBmail" whose dependency can not be determined as the system database MSDb is not in visual studio and the application may fail during runtime.

    We ignored the warning as we know that the server we are going to deploy has MSDB database and dbmail stored procedure.

    Now when our application executes the stored procedure it gaves an error as mentioned in the subject line. Whereas the account running the stored procedure has sysadmin permission and we are able to manually run the stored procedure from mgmt studio using the same account.

    Any insight will be appreciated.

    Thanks,

    Piyush

  • justpiyushmittal-1127780 (2/19/2010)


    ...Now when our application executes the stored procedure it gaves an error as mentioned in the subject line. Whereas the account running the stored procedure has sysadmin permission and we are able to manually run the stored procedure from mgmt studio using the same account....

    What is the execution context that your application is running your stored procedure?

    What I mean is, what are the sequence of things in your app (from a process, connection & login/user standpoint).

    FYI, I doubt that this is corruption.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Sounds like you should read this article[/url]. While you say the account running the procedure is in sysadmin, the error certainly indicates that it does not.

    As Barry has said, this is really not a a corruption issue.

  • Thanks for the replies.

    I have got the solution, I have to set trustworthy option on the DB so that stored procedures can execute the system objects programatically.

    Thanks Again.

  • Did you read the article I linked to? Setting TrustWorthy on has effects as well, so be sure that's what you really want to do.

Viewing 5 posts - 1 through 4 (of 4 total)

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