0

When I am only trying to create a table my "DBA" gave reader, writer, "ddladmin" to the database and I am getting this error when trying to create a basic table:

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

Can somebody please let me know the answer.

9
  • Do you have a trigger which will send an e-mail on table creation? Nov 14, 2016 at 15:01
  • No i do not have any trigger. It is a simple create script "create table dbo.zzDel (id int )"
    – jack
    Nov 14, 2016 at 15:04
  • Your DBA will have a trigger in place. Check with him Nov 14, 2016 at 15:05
  • Even though i am a DDLAdmin, why would i get that "sp_send_dbmail" error When the DBA has a trigger in place. I am not understanding
    – jack
    Nov 14, 2016 at 15:08
  • He will have defined a server level trigger. not a database level trigger. information is stored in sys.server_triggers. For example CREATE TRIGGER TriggerName ON ALL SERVER FOR ALTER_DATABASE AS Nov 14, 2016 at 15:15

1 Answer 1

2

There are two possibilities here:

  1. Your table create script includes an attempt to send an email
  2. Your DBA has placed a DDL trigger on the database to send an email notification when objects are created.

In the first instance, confirm that there are no attempted email sends from your script.

For the second the DBA might not have set the permissions correctly on the trigger itself, and so it is attempting to send an email using your credentials. Work with the DBA to either grant you permission on msdb..sp_send_dbmail so that emails will flow, or to fix up the trigger.

4
  • Coming to the first possibility, No I do not have any script which tries to send out any email. I am using a very simple create table script "create table dbo.zzDel (id int )" Coming to the second possibility, can you please throw some more light into that? Thank you
    – jack
    Nov 14, 2016 at 15:03
  • The quickest way would be to ask your DBA if they have a DDL trigger in place on table create, and if they could check that because you are getting this send email error when not trying to send email.
    – Nic
    Nov 14, 2016 at 15:27
  • He is not a cooperative person :) that is the only reason i am trying to find out the reason :)
    – jack
    Nov 14, 2016 at 15:30
  • 1
    Unfortunately without having the requisite level of permissions yourself you can't fully diagnose and resolve the problem. The best you can do is bring up the error and ask if there's a DDL trigger in place that might be causing it, and possibly ask for execute permissions on the procedure as a workaround in the interim.
    – Nic
    Nov 14, 2016 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.