On 26 May 2010, at 1:56am, Radcon Entec wrote: > I have an application that writes data into a simple SQLite table with three > fields. Two are integers and the third is a date.
If you still want us to think about this, can we see the table definition, please ? Whatever you used for CREATE TABLE. > The next things on my things I don't understand about SQLite are that columns > are not restricted to one data type, and that there is no specific date > format. I have seen a customer A database in which the column containing the > date happily contained a Julian date and then a human-readable string. But, > accepting all that without understanding it, I should be able to write a > floating-point number into my field. But when I tried, I got an exception > with this message: > > Invalid cast from 'Double' to 'DateTime'.Couldn't store <2455342.48371528> in > value_timestamp Column. Expected type is DateTime. That is definitely not a message generated by SQLite. SQlite wouldn't know a Double, and doesn't expect a DateType type. > Huh??? I didn't think there was a DateTime type, Correct. See <http://www.sqlite.org/datatype3.html> > and I thought I could write anything into any column! Correct. Columns have 'affinities' not 'types'. Although individual fields do have types. > Is this something that the ADO .Net provider is enforcing that doesn't > really correspond to the database? That is my guess, though I don't know anything about your .NET framework. That is not an official part of SQLite, it's something someone else whipped up. > What is the recommended way to write a datetime value as a Julian date? It's popular to store dates as text, and use the functions in <http://www.sqlite.org/lang_datefunc.html> for access and conversion. But if you have SQLite handle your dates as Julian dates (which are numbers, and should be handled and stored as numbers) that's okay too. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users