Home Forums SQL Server 2005 Administering extact last 3 characters from a string RE: extact last 3 characters from a string
Florian Reischl
SSC-Dedicated
Points: 37301
More actions
June 20, 2009 at 4:43 am
#1012797
Just for fun - if RIGHT and CHARINDEX is prohibited but you are allowed to use a Tally table 😀
DECLARE @txt VARCHAR(20)
SELECT @txt = 'helloALL'
SELECT
SUBSTRING(@txt, N, 1)
FROM Tally
WHERE N BETWEEN LEN(@txt) - 2 AND LEN(@txt)
FOR XML PATH('')