Firebird HQBird 4 Troubleshooting

With the update from Firebird 2.5.x to Firebird HQBird 4.x there are changes to the way SQL queries are handled.

If you write SQL or reports that query the Communicare database, the following SQL features that work in Firebird 2.5 either don’t work in Firebird 4 or should not be used:
  • Use LOCALTIMESTAMP instead of CURRENT_TIMESTAMP.
  • The return type of ‘COUNT’ columns is now ‘long’, not ‘int’. If you have anything assuming ‘int’ you may see an error due to ‘long’ being larger.
  • Good practice:
    • All tables should be assigned aliases.
    • Field aliases should use the 'as' keyword, for example, 'select p.pat_id as patient_id' rather than 'select p.pat_id patient_id'.
  • Be consistent with the coding of table joins:
    • As a general rule you should use inner joins before left outer joins.
    • Rather than using 'inner join' it is better to use 'join'.
    • Rather than using 'left outer join' it is preferable to use 'left join'.
Table 1. Replacement SQL for Firebird HQBird 4
Old SQL Replacement SQL
‘today’ Cast(‘today’ as timestamp)
‘now’ Cast(‘now’ as timestamp)
‘1996-01-01’ Timestamp ‘1996-01-01’
Cast(‘1900-01-01’ as timestamp Timestamp ‘1900-01-01’
Union Union All (when distinct list is not required)
1=1 True
SELECT * Use defined column list
Strlen() Char_Length()
rtrim(ltrim('xxx')) coalesce(trim('xxx'), '')
'starts' 'starting with'