You could also store the precision in the datatype and the client can retrieve the column declaration so that it can fiddle with the data before displaying it.
This is a client issue, not a database issue. --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.org > -----Original Message----- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of ven...@intouchmi.com > Sent: Monday, 06 May, 2013 06:20 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] Is there a way to select a precision? > > You could always store the precision info in another column or two. > > Vance > > on May 06, 2013, Paul van Helden <p...@planetgis.co.za> wrote: > > > >> A delared type of NUMBER(10,2) has NUMERIC affinity, which means that > >> SQLite will attempt to store (string) values as integers first and > floats > >> second before giving up and storing strings. > >> > > > >This has nothing to do with my reply and I understand how it works. > > > >> > >> You do realize that there are decimal numbers that have infinite binary > >> expansions? > >> > > > >I wouldn't store such numbers into a NUMBER(10,2), just a NUMBER (I know > >they are the same in SQLite). > > > >> > >> You are also talking presentation (as in formatting) of numeric values > as > >> opposed to representation (as in storing/retrieving). The former is > best > >> handled in the user interface while the latter is the subject of > database > >> engines. > >> > > > >My point was about not storing binary junk - the part of a number that > has > >no meaning because the accuracy of the inputs is limited. When you have a > >generic db manager that can show any table or if you are looking at the > >results of your own SQL statement, it helps to reduce clutter on the > >screen. The data also compresses better. > > > >> > >> Fatihful reproduction of formatting would be possible using TEXT > affinity > >> and calling sqlite3_bind_text. Performing arithmetic with these > "numbers" > >> would however be tricky, slow and would still not guarantee that > calculated > >> values would conform to the desired formatting. > >> > >> Of course, but in most cases we don't need to go this far. My main > point > >is about rounding before binding; my secondary point that scale in a > column > >definition can be desirable to avoid it. > >_______________________________________________ > >sqlite-users mailing list > >sqlite-users@sqlite.org > >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users