[dba-SQLServer] Can't drop view

Eric Barro ebarro at verizon.net
Fri Jun 5 14:40:52 CDT 2009


Why are you rebuilding the view? 

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Friday, June 05, 2009 11:45 AM
To: Dba-Sqlserver
Subject: [dba-SQLServer] Can't drop view

I have a stored procedure that drops and dynamically rebuilds a view.  This
stored procedure suddenly fails.  It turns out that the view that the SP was
trying to drop referenced a non-existent table.  I could not even "compile"
the sp.  BTW, what do you call the execute phase when you are editing a
stored procedure - as opposed to actually running the stored procedure using
EXEC()?

Anyway, when I tried to perform that step it gave me error messages.
Apparently the SP tries to open the view and if the view is bad it barfs.
>From my perspective, I don't care if the view is bad because I am going to
drop the view anyway and rebuild it from scratch.  Unfortunately if the SP
won't run then I can't drop the bad view.  Not good.

So I went in and manually deleted the view and the stored procedure runs as
I intended.

Is there any way to programmatically drop a view that references a
non-existent table, or has any other error that would prevent the view from
running?

--
John W. Colby
www.ColbyConsulting.com
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list