I have this SQL Data:
AT_SendMail_v1
AT_Certificate_v10
AT_Certificate_v100
And I want this output:
AT_SendMail_v2
AT_Certificate_v11
AT_Certificate_v101
I have this code but it doesn't work for the numbers that they more than 19:
SELECT CASE
WHEN ISNUMERIC(RIGHT([internalname],1)) = 1
THEN LEFT([internalname],LEN([internalname])-1) + cast((CONVERT(INT, RIGHT([internalname],1)) + 1) as varchar(100))
ELSE [internalname] + '_v1'
END
,[id]
FROM [task]
thanks :)