• Now, there's a small problem. What happens if you ever get a value like 'a23'?

    You should use a numeric datatype, and for even/odd numbers problem, the best type could be int.

    To find out if a number is even or odd, the classic way to go is with a modulo operator.

    WITH Tally(n) AS(

    SELECT TOP 11 ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) - 1

    FROM sys.all_columns)

    SELECT n, CASE WHEN n % 2 = 1 THEN 'Odd' ELSE 'Even' END

    FROM Tally

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2