Author Topic: SQL Query Using Firebird  (Read 1283 times)

philchudley

  • EA User
  • **
  • Posts: 687
  • Karma: +17/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
SQL Query Using Firebird
« 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
follow me on Twitter

@SparxEAGuru

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11849
  • Karma: +460/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQL Query Using Firebird
« Reply #1 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

Code: [Select]
AND    t_objectproperties."Value"    = 'Yes'
Geert

philchudley

  • EA User
  • **
  • Posts: 687
  • Karma: +17/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: SQL Query Using Firebird
« Reply #2 on: March 02, 2022, 08:25:51 pm »
Thanks Geert much appreciated

All the best

Phil
follow me on Twitter

@SparxEAGuru

Richard Freggi

  • EA User
  • **
  • Posts: 390
  • Karma: +14/-7
    • View Profile
Re: SQL Query Using Firebird
« Reply #3 on: March 04, 2022, 01:10:16 pm »
I use square brackets to escape Firebird reserved words, works for me