Subject | RE: [firebird-support] How to check whether a table exists or not? |
---|---|
Author | Alan McDonald |
Post date | 2009-05-06T22:47:56Z |
> At 06:17 AM 7/05/2009, you wrote:unless, of course, you are using IBExpert Scripter which is very
> >I am putting together my first database script for Interbase 7.5.
> Since I am still in development, I would like the script to first
> delete the tables and named contraints IF they exist. How might I do
> that?
>
> FYI, in SQL you DROP metadata objects and you DELETE data.
>
> The main showstopper for this approach is that scripts are not
> programs. They are nothing but lists of dynamic SQL statements
> executed in occurrence order. You can't do conditional things in
> scripts and you can't intercept and act on exceptions.
sophisticated. it can do conditionals, write log files do multi-db updates
etc etc.
Alan
>
> But your approach of "first deleting [sic] the tables and named
> constraints if they exist" is fraught with failure, anyway.
> Constraints create dependencies. Dependencies cause drop and alter
> statements to fail. Even if they don't fail, uncommitted metadata
> actions can have untoward effects on metadata that's entailed by later
> statements in a script unless you've planned this perfectly.
>
> ./heLen