mysql> create table t(cTime datetime default 'now()');
ERROR 1067 (42000): Invalid default value for 'cTime'
mysql> create table t(cTime datetime default now());
ERROR 1067 (42000): Invalid default value for 'cTime'应该怎么写,才可以运行?谢谢。

解决方案 »

  1.   

    the default value must be a constant; it cannot be a function or an expression
    只能是常量,不能是函数、表达式
      

  2.   

    默认值不能为now()
    在sql语句中可以写now()。insert into t (ctime) values (now())
    你可以在程序中的sql语句这样写。
      

  3.   

    上述是MYSQL的帮助,不能默认,只能是常量,不能是函数、表达式