On Tue, Jul 6, 2010 at 5:10 PM, Ted Rolle, Jr. <ster...@gmail.com> wrote: > I, (or more to the point, SQLite) can't seem to retain leading zeros > on numbers. > > The receiving field is defined as CHAR; > I'm using the SQLite Manager in Firefox. > I've also tried sqlite3 from the command line. > Here's a typical (and minimal) statement: > UPDATE UPCs SET UPC=043000205563; > UPDATE UPCs SET UPC=CAST(043000205562 AS CHAR) WHERE rowid=93; didn't > work either. > > SELECT TYPEOF(UPC) FROM UPCs WHERE rowid=93; returns 'text'. > > I'm reluctant to put quotes (single or double) around the values as > they are retained in the field. >
I have no idea why you would say that. It works just fine. sqlite> CREATE TABLE UPCs (UPC TEXT); sqlite> INSERT INTO UPCs VALUES ('043000205563'); sqlite> SELECT * FROM UPCs; UPC ------------ 043000205563 sqlite> > On other text/numeric fields I've added a textual value; that seems to > "fix" the problem. But not really. > > Last question: is this an example of SQLite's "typelessness"? > > Ted > -- > __________________________________________________________________ > 3.14159265358979323846264338327950 Let the spirit of pi > 2884197169399375105820974944592307 spread all over the world! > 8164062862089986280348253421170679 http://pi314.at PI VOBISCUM! > ================================================================== > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users