Write for Us
Error Message:Msg 15151, Level 16, State 1, Line 1Cannot %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 are corrigible by the 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;GOIF OBJECT_ID('dbo.MyDate', 'function') > 0 DROP FUNCTION dbo.MyDateGOCREATE FUNCTION dbo.MyDate()RETURNS DATETIMEWITH EXECUTE AS CALLERASBEGIN RETURN (GETDATE())END;GOGRANT 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.