In other words, you want to know if the number is an integer, right ?
The syntax could be different depending on the database being used.
Oracle:
<pre>SELECT DECODE(yourColumn,FLOOR(yourColumn),'INTEGER','NON-INTEGER')
FROM yourTable;</pre>
SQL Server:
<pre>SELECT CASE
WHEN yourColumn = FLOOR(yourColumn) THEN 'INTEGER'
ELSE 'NON-INTEGER'
END
FROM yourTable</pre>
--------------
Last Wiki Answer Submitted: June 23, 2010 10:10 pm by carlosdl63,535 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
My stockroom wants to know when the system shows that we have a fraction of a quantity in stock. For example, the system shows .333. He wants to be all items that have a fractional amount on a SQL Report. I’m trying to come up with the syntax to analyze each quantity amount and only pull those with fractions. This is a SQL Database.
My stockroom wants to know when the system shows that we have a fraction of a quantity in stock. For example, the system shows .333. He wants to be all items that have a fractional amount on a SQL Report. I’m trying to come up with the syntax to analyze each quantity amount and only pull those with fractions. This is a SQL Database.
Thanks in advance.
Just modify the above examples to put the integer check in the WHERE clause.
A marginally faster way to do this (if you have some really big tables) is:
Thank you! That was exactly what I needed!
I got my answer