Tom Shaw <[EMAIL PROTECTED]> wrote:
> 
> Using sqlite 3.3.5

You really should try to use something more recent.

> 
> UPDATE av_summary SET rank=((det*100.0)/(tot));
> 
> sets first row to an integer (serendipity?) and then all the other 
> rows are real or text which caused problems since I was expecting 
> that column was integer since that is how the table was created. I 
> see when I export that the numbers are real in the text exported. 
> This must have been what confused me.  There is obviously something 
> here that I don't grok.
> 

SQLite, unlike many other SQL database engines, strives to
avoid throwing away information.  If you have a value 1.234
and you store that value in an INTEGER column, SQLite tries
to convert the value to an integer.  But it sees that this
conversion would loss information - specifically the fraction
part 0.234.  So it stores the original floating point value
instead.  Other database engines would silently discard the
fractional part.

If you store 1.0 into a column marked INTEGER, it will convert
the value to 1, since no information is lost.

If you really have to have an integer in your column, then
use CAST() or ROUND() to round of the value to an integer first.
--
D. Richard Hipp  <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to