Subject Re: [firebird-support] Re: Does This Table, or Column, Exist?
Author Helen Borrie
At 11:03 PM 13/02/2005 +0000, you wrote:
> Testing for a table that currently exists in the
>database.
>
> Open the database, start a transaction, Prepare()
>this statement and pass it to Execute():
>
> SELECT
> 1
> FROM
> RDB$RELATIONS
> WHERE RDB$RELATION_NAME = 'nr_phrase_table_01'
>
> Execute() returns without throwing an exception.
>
> "nr_phrase_table_01" is the name of a table in
>the database. A Fetch() returns 0.
>
> I would expect Fetch to return non-zero if the
>table exists in the database.
>
> What am I doing wrong?

Object names in the system tables are stored in upper case unless you
defined them with the option double-quoted case-sensitive syntax. Your
options for getting a correct answer to your query on a system table
depends on how the object was defined.

-- If double quotes had been used and your search string was completely
case-correct then your query would have returned 1.

--- This will return 1:

SELECT
1
FROM
RDB$RELATIONS
WHERE RDB$RELATION_NAME = UPPER('nr_phrase_table_01')

./hb

p.s. (^Moderator hat^ on) However you feel about yourself, your Yahoo nick
delivers a disrespectful message to people whom you expect to help
you. This account has been set to Read Only.