'cannot drop the view 'XXX' because it does not exist or you do not have permission
We migrated our servers from 2005 to 2014, User is able to delete it in the 2005 server But in 2014 we are getting the error as do not have permission or does not exits We have given to same permissions and even he is a system admin.In our application side they are not able to drop the view the application users are connecting through a user in our database he has all the permissions and he is sysyadmin
Solution 1:[1]
This problem can be simply solved if its simply happening, follow the steps:
- See which database you are working in, e.g I am working in the database
student_fast
. - After getting the database name you are working in, write a query (use database_name) and execute it.
- Now try drop command.
- It works as per my problem.
Solution 2:[2]
I had a very similar problem. Make sure that the Schema didn't change when you moved the database.
In my case all the tables and views were placed in a schema with the databasename, so instead of the tables be called eg. table1, they were called database.table1.
As said, this is one reason this error is displayed.
Edit: after seeing the comments they suggest the same thing, to use the schema before the tablename, and yes. if dbo is your schema, then try writing dbo.tablename
Solution 3:[3]
I've faced the same problem (SQL Server 2016).
It is a little bit strange, but when I connect to SQL Server via Windows Authentication using my local Windows Account (that is also mapped to sa
) I get this error.
When I connect to SQL Server via SQL Server Authentication using username sa
and its associated password, I have all the permissions and this nasty error disappears.
Solution 4:[4]
If an application/any other process is already connected to the database you are trying to drop , you may get that error. Try to disconnect from the database first and drop the schema , it should work.
Solution 5:[5]
Restarting the SQL server worked for me. But it's not an affordable solution for production environments...
Solution 6:[6]
Error :- "Cannot drop the table 'ProductDb', because it does not exist or you do not have permission." even I was facing the same error..... then I created the same table with same name and same attributes. then update the database or refresh the database it solved my error. This error occurred when you delete the table directly from the database.
Solution 7:[7]
In your case check if you make Drop view Statement twice , sometimes you delete the view in two different places , this will cause to this problem .
Solution 8:[8]
It has been years since it is posted. I run across the same situation. If I run as followed:
Drop view [Schemaname.viewname]
It will have the error.
If I take away the [ ]
, as
Drop view Schemaname.viewname
It works. Not sure what's the reason.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ×¡×˜× ×œ×™ ×’×¨×•× ×Ÿ |
Solution 2 | Sourcery |
Solution 3 | |
Solution 4 | mykey |
Solution 5 | Nir |
Solution 6 | Pawan Kumar |
Solution 7 | Sameeh Shahin |
Solution 8 | RN92 |