Posts

Showing posts from April, 2022

Remove Alpha letter from string at the end

If the last letter from a string is Alpha then remove it otherwise return the string as it is.  DECLARE @STR nvarchar(200) = '1641746A' if ISNUMERIC(RIGHT(@STR,1))=0 begin SET @STR = SUBSTRING(@STR, 1, (LEN(@STR) - 1)) SELECT @STR END ELSE SELECT @STR