How do I check the last two digits?
3 answers
To check the last two digits enter the digits in the column, you can use the following script.
... WHERE ISNUMERIC(RIGHT(your_column,2)) = 1
This RIGHT(your_column,2)
will return the last two digits from the string.
or
SELECT ISNUMERIC(RIGHT(your_column,2))
will return 1 (if its a number), otherwise 0
+1
source to share
You can do it like this:
SELECT MyId,
ISNUMERIC(RIGHT(MyColumn,2)) -- your column to check last 2 (if numeric)
FROM (
----- replace with your table
SELECT 1 MyId,'SUBBIS' MyColumn UNION SELECT 2,'SUBB1D' UNION
SELECT 3,'SUBBD3' UNION SELECT 4,'SUBB12'
----- replace with your table
) A
Hope this helps. :)
0
source to share