You're right that SQLite will ignore any field specifications...
But it will not "treat the value as real".  It will store whatever you give
it.  The system is typeless.
http://www.sqlite.org/datatypes.html
This is different than most other database systems.

SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t(a number(2));
sqlite> insert into t values('blah');
sqlite> insert into t values(2);
sqlite> insert into t values(2.1);
sqlite> select * from t;
blah
2
2.1
sqlite> select typeof(a) from t;
text
integer
real

Mike

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin
Sent: Wednesday, July 10, 2013 4:10 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] What number(2) means?


On 10 Jul 2013, at 8:44am, Woody Wu <narkewo...@gmail.com> wrote:

> I have an old dabase, some integer columns were defined as type of
> number(2).

It limits the number of digits after the decimal point to 2.  In other
words, it's what you might use if you wanted an amount of dollars
automatically truncated to cents as the value is stored.

It'll be ignored by SQLite, of course.  SQLite will treat the value as REAL
and store all the digits it can fit in a REAL.

Simon.
_______________________________________________
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

Reply via email to