divide - SQL - test if numeric field is holding an integer -


i have numbers (from select)

    col1         col2   1. 3.6   ,    3   2. 3.6   ,    5 

i want this

if(col1/col2 = integer)     update column else(col1/col2  = decimal number)     update column 

any idea how number integer or decimal?

you use modulo 1 (% 1), , if remainder 0 have 'integer'. example, sql server:

if (col1 / col2 ) % 1 = 0     -- integer else    -- decimal 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -