Pregunta

What is an equivalent to RIGHT() (as in FB2.5) for older versions of firebird (Firebird 2.0) without using UDFs?

¿Fue útil?

Solución

Use SUBSTRING and CHARACTER_LENGTH functions. Both internally available as of version FB 2.0:

SELECT
  IIF(CHARACTER_LENGTH(str_field) <= <right_characters_count>,
    str_field,
    SUBSTRING(str_field FROM 
      (CHARACTER_LENGTH(str_field) - <right_characters_count> + 1)))
FROM
  some_table
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top