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
Post a Comment