var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Selecting the last 3 characters from a string
I am trying to select the last 3 characters from a string. I am running into problems because the sting that I am selecting from are not the same amout of characters.
How would I be able to select the last three characters from a list that could have more than 50 variations on the number of characters.
I tryed right(item, 3) but that does not work because all the lenghts are different. Any ideas?
substring (reverse(field), 1, 3)
EDIT: If you want them in original order:
reverse (substring (reverse(field), 1, 3))
The RIGHT() function should work for you.
What is the datatype of ITEM? Post some sample data, and the results you get from the RIGHT(Item, 3) function.
I'm not sure I understand..
Isn't this what you want?
DECLARE @t table (Col1 varchar(50))
INSERT INTO @t (Col1)
SELECT 'abc145264' UNION ALL
SELECT 'efg1254' UNION ALL
SELECT RIGHT(Col1,3) FROM @t