I've written an OnSave Macro in VMFG that calls a SQL Stored Procedure, written in the VM DB, that calls the SP_SEND_DBMAIL stored procedure in the msdb database.
When running my Macro, I am getting the message "The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'."
At first I had the same problem calling the stored procedure that I wrote in the VM database, but I gave the user Execute Permission to that stored procedure, and that fixed that problem. But the problem shifted now to the sp_send_dbmail procedure.
I tried mapping the user to the DatabaseMailUserRole in the msdb database, but that did not fix the problem. I could not add the user to securables in the msdb sp_send_dbmail procedure (the option is not available).
I tried the same thing for the user SYSADM figuring that it was a "Blind User" (the #USER) because SYSADM does not have a Blind User, but get the same error.
After doing this though, I was able to Execute my stored procedure when running it in SSMS, logged in as the user, or as SYSADM, but I still get the error when my OnSave Macro tries to run my Stored Procedure (the error regarding permissions to the sp_send_dbmail).
I don't understand why it works in SSMS, but not in VMFG.
In Visual, does the system access the SQL database solely as the logged in user? Does it access SQL as the Blind user?
Does anyone have any insight into this issue?
Any help would be appreciated.
Thanks, and Regards,
John Keegan