How to return the last value of an sql string?

Asked

Viewed 400 times

6

I need to use the last character of a string G. Like I get it with sql server?

SET @VALOR = '0000050529-G'

I want to take the letter G

1 answer

10

Use the function RIGHT() it returns the(s) N character(s) on the right, the quantity is informed by the second argument.

SET @VALOR = RIGHT('0000050529-G', 1)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.