determine if number is odd even in tsql sql server
A user asked the best way to determine if the number is odd or even, there is no builtin SQL Server function in my knowledge which can simply return True False or tell if number is odd number or even number. There is another trick to check if number is odd or even.
Here is the T-SQL Script.
SELECT
Column_Name,
CASE WHEN cast(Column_Name as int) % 2 = 1
THEN 'Odd'
ELSE 'Even'
END
FROM Table_Name
Advertisements
MySQL HOSTING
MySQL hosting provider, clustering and replication supported. DBA Services Included.
SQL SERVER HOSTING
Reliable, powerful SQL Server 2008 hosting with ASP.NET on Windows 2008 Servers.
SQL Server DBA
I am a
SQL Server DBA with almost 9 years of experience in database
technologies.
I am again in process of redesigning this website using ASP.NET 2.0 and AJAX. The main purpose
of new SQL DBA website is to offer more features and make it easy for
me to update contents on regular basis.