Grant execute on xp_logevent to sa using sa user to do it
2
votes
2
answers
4631
views
Running a SQL Server 2012 CLR stored procedure with this code:
const string executeLog = "EXEC master..xp_logevent @errorNumber, @message, informational";
using (SqlCommand cmd = new SqlCommand(executeLog, connection))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@errorNumber", 60001);
cmd.Parameters.AddWithValue("@message", url);
cmd.ExecuteScalar();
}
I get this error:
> System.Data.SqlClient.SqlException: The EXECUTE permission was denied
> on the object 'xp_logevent', database 'mssqlsystemresource', schema
> 'sys'.
I've tried to do this as
sa
user:
grant execute on xp_logevent to sa
But I get another error:
> You can not find user 'sa' that does not exist or the user does not
> have permission.
How can I grant execute permissions to sa user?
Asked by VansFannel
(1873 rep)
Jun 30, 2015, 10:58 AM
Last activity: Nov 10, 2016, 08:36 PM
Last activity: Nov 10, 2016, 08:36 PM