views:

23

answers:

1

Hi, I got the following number as a string: String numberString = "079674839";

When I insert this number into a SQLite DB, SQLite automatically removes the leading zero and stores the string as 79674839. Considering affinity and that the column stores TEXT, shouldn't SQLite store the whole string and keep the leading zero?

Thanks

+1  A: 

Use single quotes around the number, (i.e., '079674839') if it is anywhere in inline sql code. Also, if you're doing this programatically, make sure that you are not going through a numeric conversion.

Michael Goldshteyn
I am adding the strings programatically. So, Is there a way to store a number including the leading zeros in SQLite?
ram
I finally hacked the problem by adding a token to the number before inserting the number in the DB, and removing the token after retrieving the number from the DB. However it requires String manipulation which is very slow.
ram