ANSI SQL 92: find last occurrence of character

2019-07-26 12:27发布

问题:

I need a ANSI SQL 92 statement to change all characters following the last '/' character to lower case.

On Sybase I would write:

update table 
set col = left(col, len(col)-charindex('/', reverse(col))) ||
          lower(right(col, charindex('/', reverse(col))))

I can find all functions in ANSI SQL 92 but the REVERSE function, that I just use to find the last occurrence of the slash.