有没有办法在sqlite3中创建一个datetime列默认为'now‘的表?
以下语句返回语法错误:
create table tbl1(id int primary key, dt datetime default datetime('now'));ddl更新:这是Sky Sanders提供的正确的
create table tbl1(id int primary key, dt datetime default current_timestamp);发布于 2010-04-11 07:16:07
... default (datetime(current_timestamp))default后面的表达式必须用括号括起来。如果您想要使用SQLite date and time functions or modifiers执行日期运算,则此表单非常有用。
发布于 2011-06-26 20:47:35
和'mystring'一样,CURRENT_TIMESTAMP也是一个文字值
column-constraint:

literal-value:

发布于 2017-08-19 18:45:59
可以使用以下查询在表中使用当前日期值
create table tablename (date_field_name Created_on default CURRENT_DATE);https://stackoverflow.com/questions/2614483
复制相似问题