Reputation: 239
I have numbers (from my select)
col1 col2
1. 3.6 and 3
2. 3.6 and 5
I want this
if(col1/col2 = integer)
update column
else(col1/col2 = decimal number)
update column
Any idea how to get is number integer or decimal?
Upvotes: 0
Views: 531
Reputation: 1745
You could use modulo 1 (% 1), and if the remainder is zero then you have your 'integer'. For example, with SQL Server:
if (col1 / col2 ) % 1 = 0
-- integer
else
-- decimal
Upvotes: 2