27

How do I store long values in Android SQLite database ? I am trying to store the time(milliseconds) values which comes in long type format .

zafi005
  • 500
  • 1
  • 5
  • 12

3 Answers3

55

An INTEGER column will handle long values.

From the SQLite site:

INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

Datatypes In SQLite Version 3

keyser
  • 18,829
  • 16
  • 59
  • 101
3

You can define a column with Integer datatype. For more info go through this link

Aswin
  • 1,154
  • 1
  • 11
  • 29
1

If you don't care about sign, store it as INT8. It's 8 bytes (64 bits) unsigned. Or, convert to/from string.

Simon
  • 14,407
  • 8
  • 46
  • 61
  • INT8 will be converted to INTEGER in sqlite. (Or, at least that's how I understood the affinity section) – keyser Sep 25 '12 at 14:05