Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: philchudley on March 02, 2022, 03:46:47 am

Title: SQL Query Using Firebird
Post by: philchudley on March 02, 2022, 03:46:47 am
Hi All

I personally do not use Firebird as an EA repository, but I have a client who does, and I have run into a SQL Query problem.

Using a SQL query like the one shown below:

SELECT t_object.Name
FROM   t_object, t_objectproperties
WHERE  t_object.Object_ID = t_objectproperties.Object_ID
AND    t_objectproperties.Property = 'Publish?'
AND    t_objectproperties.Value    = 'Yes'

Fails since Value is a reserved word, but certainly is the column name.

Value is highlighted in Blue in the SQL Scratch Pad but works in other repository formats, so how do you use the t_objectproperties.Value column in SQL queries for Firebird?

Thanks

Phil
Title: Re: SQL Query Using Firebird
Post by: Geert Bellekens on March 02, 2022, 04:22:56 am
Phil,

You have to escape the keywork in that case.

For SQL Server or Access that is done using the square brackets.

In Firebird it seems to double quotes

https://stackoverflow.com/questions/1800841/using-reserved-word-timestamp-as-a-field-name-firebird-2-5 (https://stackoverflow.com/questions/1800841/using-reserved-word-timestamp-as-a-field-name-firebird-2-5)

Code: [Select]
AND    t_objectproperties."Value"    = 'Yes'
Geert
Title: Re: SQL Query Using Firebird
Post by: philchudley on March 02, 2022, 08:25:51 pm
Thanks Geert much appreciated

All the best

Phil
Title: Re: SQL Query Using Firebird
Post by: Richard Freggi on March 04, 2022, 01:10:16 pm
I use square brackets to escape Firebird reserved words, works for me