> SQLite does not have a dedicated DATE type. I know that, but why it does't create appropriate column definition ? create table tab(col date); creates a table with "date" type. create table tab2 as select * from tab; also. This type does't do much, but it can be queried with sqlite3_column_decltype. This way I know what to do with text stored in the database. Currently the only way I see is to create table and then insert .. as select which seems to be weird in presence of a function that "changes the datatype".
----- Original Message ----- From: "Igor Tandetnik" <[EMAIL PROTECTED]> To: "SQLite" <sqlite-users@sqlite.org> Date: Mon, 28 May 2007 10:36:50 -0400 Subject: [sqlite] Re: CAST > [EMAIL PROTECTED] wrote: > > I'm wandering if CAST is supposed to work? > > Yes. > > > sqlite> create table tab(col date); > > sqlite> insert into tab values('1994-11-11'); > > sqlite> create table tab2 as select cast(col as DATE) from tab; > > sqlite> .schema tab2 > > CREATE TABLE tab2("cast(col as DATE)"); > > sqlite> select * from tab2; > > 1994 > > SQLite does not have a dedicated DATE type. See > http://sqlite.org/datatype3.html . When given an unknown type, SQlite > assumes numeric. That's why CAST('1994-11-11' as DATE) produces 1994. So > would CAST('1994-11-11' as ANY_RANDOM_STRING). > > It is customary to store dates as strings in SQLite. Several functions > are provided to manipulate dates in this representation. > > Igor Tandetnik > > > > ----------------------------------------------------------------------------- > To unsubscribe, send email to [EMAIL PROTECTED] > > ----------------------------------------------------------------------------- > > > ---------------------------------------------------------------------- Ile masz w domu niepotrzebnych rzeczy? Wymien sie z sasiadami >> http://link.interia.pl/f1a93 ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------