[dba-SQLServer] Can't drop view

Francisco Tapia fhtapia at gmail.com
Fri Jun 5 15:32:03 CDT 2009


What is the code you are using?

is it just DROP VIEW vwMyView

what is the error message, a lot of times you can use a Try Catch to move
around the error messages to allow your sproc to continue running.  Post a
snippet of the code and the error message I'll try to re-create the error
here.

-Francisco
http://sqlthis.blogspot.com | Tsql and More...


On Fri, Jun 5, 2009 at 12:53 PM, jwcolby <jwcolby at colbyconsulting.com>wrote:

> The view is used at a later step in a process and has varying fields.
>
> John W. Colby
> www.ColbyConsulting.com
>
>
> Eric Barro wrote:
> > 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
> >
> > _______________________________________________
> > dba-SQLServer mailing list
> > dba-SQLServer at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > http://www.databaseadvisors.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