Domanda

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

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top