Solved

SQL Deleting Views Trouble

Posted on 2012-04-06
4
542 Views
Last Modified: 2012-07-13
I am using SQL Server 2008 R2 Studio Manager and using the Northwind Database.
I created 4 views, emp_vu1, prod_cat_vu, m_emp_vu, and mexico_cust_vu and I am having trouble deleting these views.

This is the code:

DROP VIEW emp_vu1
DROP VIEW prod_cat_vu
DROP VIEW m_emp_vu
DROP VIEW mexico_cust_vu

I get an error that says:
"Cannot Drop the View because it does not exist or you do not have permission"

The views are their since I created them but just cannot drop them.
Please help.
0
Comment
Question by:J3Brother
4 Comments
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 125 total points
ID: 37817614
Hi. Please note the last portion of the error, "you do not have permission." Is there a possibility that the account you are using does not have the DROP VIEW permission? What schema did you create the views in originally? i.e., double check that you are in the correct database and referencing the views with the proper qualified name.
0
 
LVL 15

Assisted Solution

by:Deepak Chauhan
Deepak Chauhan earned 125 total points
ID: 37817741
please check view name in sys.view  system view  or you can see all these in view folder in management studio. if these all view are able to see it then check drop permission and database  also.
0
 
LVL 3

Assisted Solution

by:MrHswede
MrHswede earned 125 total points
ID: 37817775
it could also be that you are trying to execute a delete for the views on the incorrect database.

Try to use this syntax:

Use MyDb (replace it with the database where the views reside)
GO

Drop view MyView1
Drop view MyView2
etc

/Martin
0
 
LVL 7

Accepted Solution

by:
Anoo S Pillai earned 125 total points
ID: 37818090
Connect to SQL server through SQL Server Management Studio, create a DROP view script from there. ( Please see the picture ) . Execute the drop script on the database. ( To confirm whether this is a real permission issue )
DropViewIf drop command fails; this could be a  permission issue, you should grant required permissions ( say for example GRANT ALTER ON view to the user).
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question