Pergunta

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

Foi útil?

Solução

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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top