Store NaN Values ​​in SQLite Database

I would like to insert NaN values ​​into a SQLite database.

I have an Ent table with Id, StringColumn and DoubleColumn (cannot be nullable), and I'm trying to use the following SQL statement:

INSERT INTO Ent (Id, StringColumn, DoubleColumn) VALUES (1, 'NaN test', ????)

I do not know what to put in place of '????' for storing NaN.

I access the database using System.Data.SQLite - perhaps this also matters?

+5
source share
4 answers

I asked the guys from SQLite how to deal with the problem: http://system.data.sqlite.org/index.html/tktview/e06c4caff3c433c80616ae5c6df63fc830825e59 . They added a new connection flag: "GetAllAsText", and now you can store NaN along with the rest (Infinity, -Infinity).

+7

SQLite ... lax... . "NaN" , "". "". "", . SQLite .

+4

SQLite does not have a textual representation of NaN values.

In SQL, special NULLbehaves similarly in calculations and can serve the same purpose.

+1
source

The trick I'm currently using is to store -Infinity on Real columns when null is not sufficient or invalid (since you have "not null" in that column).

+1
source

All Articles