Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 how to test if number is even or odd

Author  Topic 

msa969
Starting Member

13 Posts

Posted - 2002-02-26 : 13:58:22
I have a table with a column called numbers.
This has random numbes.

How would I test if the number is even or odd in sql.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-26 : 14:12:56
SELECT CASE Numbers % 2 WHEN 1 THEN 'Odd' ELSE 'Even' END Odd_Even
FROM myTable


Go to Top of Page
   

- Advertisement -