View can be dropped using the DROP VIEW command. Is there a solution for handling DROP TABLE if there is a view on a table?
I tried like
DROP TABLE ORDER_TBL CASCADE;
Is there another way in a modern DBMS?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Option 1:
If you run this script before
DROP TABLE, it lists all objects that have a reference on your table:If you want just views, you can filter the above query by
AND s.xtype='V'.Option 2 :
You can add WITH SCHEMABINDING to the definition of your view so you can not drop based table.