[thelist] Dropping a view in SQL Server

rudy r937 at interlog.com
Wed May 9 16:03:10 CDT 2001


>: >Yes actually... but i don't want the error....
>:
>: okay, you can ignore the error   ;o)
>:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> only if the middleware you're using supports
> error suppression or try/catch logic.
>
>something to think about,


hi jeff

okay, i thunk about it, and i thunk you took this out of context   =o)

not that your comment isn't right, error trapping *is* important, but in
this case the error should never happen in production

marios was trying to set up a view on a sql/server database (presumably a
remote database with no direct Query Manager connection), so the sql had to
be passed in via ASP

after the view was first declared (or not), it had to be dropped,
presumably so as to define it again differently, i.e. a development
scenario --

> Can anyone tell me how can I check whether a view exists,
> and if it exists to drop it.

my suggestion was to just go ahead and run the drop view sql statement, and
ignore the error if any --

>    drop view foobar
>
> if it existed, it doesn't now
>
> if it didn't, it still doesn't   ;o)

i guess my assumption was that a view would not get created, dropped,
recreated, etc. in a production scenario -- the requirement to drop it
occurred in development mode, while getting the view ready

i still believe that a "sorry, the view you are trying to drop does not
exist" error can simply be ignored during the process of getting a database
ready for production, unless, as elmer would say, "there's something
awfuwwy scwewy going on awound hewe" with ASP


rudy





More information about the thelist mailing list