|
declare @SQL_ALL CHAR (255)
declare @SQL_CHAR CHAR (255)
declare @SQL_INT CHAR (255)
declare @SQL_LEN INT
declare @INT_LEN INT
select @ SQL_ALL = 'AA121334A16552'
SELECT @ SQL_LEN = len (@SQL_ALL)
select @ INT_LEN = 1
while SUBSTRING (@ SQL_ALL, @ SQL_LEN- @ INT_LEN, 1) BETWEEN '1' AND '9'
SELECT @ INT_LEN = @ INT_LEN + 1
SELECT RIGHT (RTRIM (@SQL_ALL), @ INT_LEN)
--------------
16552 |
|