Subject | Re: [firebird-support] Dropp table if exists |
---|---|
Author | Helen Borrie |
Post date | 2005-03-01T23:47:30Z |
At 07:22 PM 1/03/2005 +0200, you wrote:
definitions. Table names are stored in RDB$Relations.
2. DROP <something> won't work with anything. Consult documentation to get
the valid syntax for SQL.
3. DDL operations can't be done from stored procedures.
access. Query RDB$Relations to test whether the table is present; proceed
to issue a DROP TABLE <table-name> on the basis of the result.
application can intercept exceptions and proceed accordingly. You can
query the table RDB$Dependencies to determine your strategy.
Commit rigorously.
./heLen
>I am converting a sql database to firebird...1. RDB$Generators stores generator definitions, not table
>
>I cannot figure out how to check if a object already exists and if it does
>drop it
>
>This is my best best but it does not work:
>
>IF exists (select * from RDB$GENERATORS where RDB$GENERATOR_NAME =
>'GEN_USEDDS_ID1')
>then
>drop'GEN_USEDDS_ID1'
definitions. Table names are stored in RDB$Relations.
2. DROP <something> won't work with anything. Consult documentation to get
the valid syntax for SQL.
3. DDL operations can't be done from stored procedures.
>Does anyone know how this should be done?With extreme caution, from a client application, and with exclusive
access. Query RDB$Relations to test whether the table is present; proceed
to issue a DROP TABLE <table-name> on the basis of the result.
>Also if there is a dependency how do I make sure that the objects are allThe engine won't let you delete objects that have dependencies. Your
>deleted ?
application can intercept exceptions and proceed accordingly. You can
query the table RDB$Dependencies to determine your strategy.
Commit rigorously.
./heLen