Reputation: 13839
is there a cast in sqlite, I need this to work in a create table definition ...
....
mydatetime numeric not null DEFAULT (strftime('%Y%m%d%H%M','now', 'localtime')) );
thanks
Upvotes: 1
Views: 361
Reputation: 32094
sqlite> .headers on
sqlite> CREATE TABLE t1 (mydatetime int not null DEFAULT (strftime('%Y%m%d%H%M',
'now', 'localtime')), otherval TEXT);
sqlite>
sqlite> INSERT INTO t1 (otherval) VALUES ('qwe');
sqlite> SELECT * FROM t1;
mydatetime|otherval
201201231947|qwe
Upvotes: 1