I'm getting the following error when calling a stored procedure:
Cannot find the object "XXX" because it does not exist or you do not have permission.
I've checked the database and the SP is there with the correct permissions yet I'm still getting the error.
Any suggestions?
Always use the
dbo.
(or other schema) prefix both when creating and when accessing objects.I wrote about this very topic recently:
The account that you are using when calling the stored procedure must not be the same account that you are using to check it. Make sure that the account that you are using to execute the sproc has access to the object.
Using the 'GO' fixed the issue for me as well. This was driving me crazy, after multiple drops and checking permissions for users and schema, this is what finally helped.
I meet this issue too. In my case, I granted execution permission just after creating stored procedure. And there is no 'GO' between the two statements. I added GO, and it works.