Msg 15151, Level 16, State 1, Line 1
Cannot %S_MSG the %S_MSG ‘%.*ls’, because it does not exist or you do not have permission.
This error message appears when you, for example, try to grant permissions to a nonexisting user.
The T-SQL statement can be parsed, but causes the error at runtime.
Errors of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. The referenced object must exist and you must have appropriate permissions to access it.
All versions of SQL Server.
IF OBJECT_ID(‘dbo.MyDate’, ‘function’) > 0
DROP FUNCTION dbo.MyDate
CREATE FUNCTION dbo.MyDate()
WITH EXECUTE AS CALLER
GRANT EXECUTE ON dbo.MyDate TO a
In the above example we try to grant permissions to the nonexisting user ‘a’. This raises the error.