Cannot find the object “XXX” because it does not exist or you do not have permission

前端 未结 13 1074
[愿得一人]
[愿得一人] 2021-01-11 11:23

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\'

相关标签:
13条回答
  • 2021-01-11 12:02

    Even after adding 'GO' issue did not fixed for me. Then removed UPDATE STATISTICS [Table_name] statement Then my issue was fixed.

    0 讨论(0)
  • 2021-01-11 12:03

    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.

    0 讨论(0)
  • 2021-01-11 12:11

    In Microsoft SQL server, selected the object in the object explorer that you want to work with, right-clicking it, then doing 'Script [object] as' can give you the script you need to perform an operation successfully without getting this error

    0 讨论(0)
  • 2021-01-11 12:12

    Ok, here's what happened. There was a special character before the end of the SP so it was incomplete yet still valid, somehow.

    So I could see the SP and see the permissions on it but I could not run it. So to solve the issue I had to copy the text out of SQL Management Studio and paste it into Notepad, then remove the special character, then copy and paste it back into SQL Management Studio and run the alter script.

    Very strange how the character got there!

    0 讨论(0)
  • 2021-01-11 12:13

    Similar to marked answer: The final line of my stored procedure was a line which granted permission to the stored procedure to run as the appropriate user - probably added there when I generated a script.

    Removing that (or perhaps a hidden character attached) managed to fix it.

    "XXX" was the name of the stored procedure I called, successfully (it made the desired change) but which gave me this error.

    0 讨论(0)
  • 2021-01-11 12:16

    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.

    0 讨论(0)
提交回复
热议问题