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

Comments

Popular posts from this blog

To Get All the Names of tables and Databases their data have changed in last 24 Hours And Backup those databases

Break comma separated into multiple rows in MYSQL

mysql global search procedure