{"id":231,"date":"2012-05-29T09:12:50","date_gmt":"2012-05-29T09:12:50","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2012\/05\/29\/msg-15151-level-16-state-1-line-1-cannot-find-the-user-username-because-it-does-not-exist-or-you-do-not-have-permission\/"},"modified":"2012-05-29T09:12:50","modified_gmt":"2012-05-29T09:12:50","slug":"msg-15151-level-16-state-1-line-1-cannot-find-the-user-username-because-it-does-not-exist-or-you-do-not-have-permission","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2012\/05\/29\/msg-15151-level-16-state-1-line-1-cannot-find-the-user-username-because-it-does-not-exist-or-you-do-not-have-permission\/","title":{"rendered":"Msg 15151 Level 16 State 1 Line 1 Cannot find the user ‘username’ because it does not exist or you do not have permission."},"content":{"rendered":"


\nMsg 15151, Level 16, State 1, Line 1
\nCannot find the user ‘username’, because it does not exist or you do not have permission.
\n<\/font><\/p>\n

Example:<\/strong>
\n[sql]
\nGRANT EXECUTE ON OBJECT::dbo.test to username
\n[\/sql]<\/p>\n

Fix\/resolution:<\/strong><\/p>\n

– Check if the user exists
\n[sql]
\nSELECT * FROM sys.server_principals WHERE name = N’username’
\n[\/sql]
\n– Check if the stored procedure exists
\n[sql]
\nSELECT * FROM sys.procedures WHERE name = N’test’
\n[\/sql]
\n– Make sure that the query is being executed in the database in which the stored procedure exists<\/p>\n","protected":false},"excerpt":{"rendered":"

Msg 15151, Level 16, State 1, Line 1 Cannot find the user ‘username’, because it does not exist or you do not have permission. Example: [sql] GRANT EXECUTE ON OBJECT::dbo.test to username [\/sql] Fix\/resolution: – Check if the user exists [sql] SELECT * FROM sys.server_principals WHERE name = N’username’ [\/sql] – Check if the stored…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2054],"tags":[2055,2056],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/231"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=231"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/231\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}