I have string column email_id; the data will look like this:
email_id
"1"
"6"
"3 4"
"8"
"0 3"
"0 5 7"
I want to get list of ids as integer. If I have two numbers in my string, I want the last one. My result should look like;
SELECT some_function (email_id ) FROM table
1
6
4
8
3
7
Is it possible to do this in SQL Server?
IF and ONLY IF, all your values can reliably be cast to an INT, and there is only ever one space at most.
EDIT To deal with a list of
nvaluesThis isn’t pretty, but it avoid recurrsion and/or loops. If someone gives an answer without REVERSE() test to see if it’s faster than this or not.