Cannot %S_MSG the %S_MSG '%.*ls', because it does not exist or you do not have permission.

Error Message:
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.

Severity level:
16.

Description:
This error message appears when you, for example, try to grant permissions to a nonexisting user.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
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.

Versions:
All versions of SQL Server.

Example(s):
USE tempdb;
GO
IF OBJECT_ID(‘dbo.MyDate’, ‘function’) > 0
 DROP FUNCTION dbo.MyDate
GO
CREATE FUNCTION dbo.MyDate()
RETURNS DATETIME
WITH EXECUTE AS CALLER
AS
BEGIN
 RETURN (GETDATE())
END;
GO
GRANT EXECUTE ON dbo.MyDate TO a

Remarks:
In the above example we try to grant permissions to the nonexisting user ‘a’. This raises the error.

]]>

Leave a comment

Your email address will not be published.