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

TSQL To Get All the Names of tables and Databases whose data have changed in last 24 Hours

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

Apply paging in procedure