Re: [sqlite] Numbers as CHARs.

2010-07-07 Thread Ted Rolle, Jr.
On Tue, 6 Jul 2010 17:13:44 -0500 P Kishor punk.k...@gmail.com wrote: 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 Oh, by

[sqlite] Numbers as CHARs.

2010-07-06 Thread Ted Rolle, Jr.
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

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread P Kishor
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

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Simon Slavin
On 6 Jul 2010, at 11:10pm, Ted Rolle, Jr. wrote: The receiving field is defined as CHAR; [snip] SQLite has no such type. Define the fields as TEXT instead: http://www.sqlite.org/datatype3.html Then try 'UPDATE UPCs SET UPC=043000205563;' and see what you get. Last question: is this an

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Ted Rolle, Jr.
On Tue, 6 Jul 2010 17:13:44 -0500 P Kishor punk.k...@gmail.com wrote: sqlite CREATE TABLE UPCs (UPC TEXT); sqlite INSERT INTO UPCs VALUES ('043000205563'); sqlite SELECT * FROM UPCs; UPC 043000205563 sqlite I did as you said with sqlite and it worked perfectly. Thank you.

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Pavel Ivanov
The receiving field is defined as CHAR; [snip] SQLite has no such type.  Define the fields as TEXT instead: Simon, please don't confuse poor users. SQLite will work perfectly and indistinguishably well with both CHAR and TEXT. Please read the link you gave more carefully (hint: bullet number 2

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread P Kishor
On Tue, Jul 6, 2010 at 8:45 PM, Pavel Ivanov paiva...@gmail.com wrote: The receiving field is defined as CHAR; [snip] SQLite has no such type.  Define the fields as TEXT instead: Simon, please don't confuse poor users. SQLite will work perfectly and indistinguishably well with both CHAR and

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Pavel Ivanov
So, because type VLADIVOSTOK is not recognized, sqlite tries to convert any value entered, even if it is delimited with single quotes, to something recognizable. I guess it starts with INT, and since it is able to convert '043000205563' to integer, that is what it does. In the case of

Re: [sqlite] Numbers as CHARs.

2010-07-06 Thread Jay A. Kreibich
On Tue, Jul 06, 2010 at 09:45:50PM -0400, Pavel Ivanov scratched on the wall: Leading zeros in the number can never be significant, While that's true for SQL values, it isn't true in the general case. C programmers and old-school UNIX folks tend to get very nervous about leading zeros.