Mail Fails with SQLCMD Error

  • Comments posted to this topic are about the item Mail Fails with SQLCMD Error

  • The Database Mail Profile that is used for the SQL server agent need to be a member of DatabaseMailUserRole in the msdb database.

    https://msdn.microsoft.com/en-us/library/ms186358.aspx#Security

  • You are right. I might have missed this point in the article - the problem here is the job worked fine when run on other databases (master,msdb etc.,) but failed only when run on user database. That's the reason it took a bit of time to narrow down the issue.

  • If your service account didn't have the permissions to access your database, wouldn't other jobs be failing as well? Or is this the only time you access this specific DB?

  • I was setting up a new server and this was the only job accessing the user database at that point of time. When I was making sure all the setup was done properly, I encountered this issue.

    Thanks,

    Ramya

  • I am having a new issue that is similar. However, mine appears to be unrelated to SQLAgent. My query fails when executing in SSMS. This is on a two instance install of SQL 2014, with the query working fine on Instance 1 but failing on Instance 2 . I have confirmed this on a separate dual instance installation of SQL 2014. I get "Failed to initialize sqlcmd library with error number -2147024809".

    Thoughts?

  • Are both the servers running on same service account? Could you please paste the query that is giving this error?

    Thanks!

  • Thanks Buddy. Profiler suggestion helped me a lot. 🙂

    Thank You.

    Regards,
    Raghavender Chavva

  • Thanks for this. I know this is an older article, but it just saved my bacon.



    Everything is awesome!

  • The MSSQL certification exams spend a huge amount of time explaining NUMA nodes, but they don't mention THIS!  Thank you for pointing this out.

Viewing 10 posts - 1 through 10 (of 10 total)

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