Hi Jason

The DEFAULT value can't be an expression.



2009/6/26 Jason Todd Slack-Moehrle <mailingli...@mailnewsrss.com>

> Hi All,
>
> I want to create a table that defaults to current_date and current_time.
>
> I have:
>
> CREATE TABLE `personalevent`(
>        `pevent` mediumint(10) NOT NULL,
>        `eventid` mediumint(10) NOT NULL,
>        `userid` mediumint(10) NOT NULL,
>        `username` varchar(10) NOT NULL,
>        `password` varchar(10) NULL,
>        `country` varchar(45) NULL,
>        `zipcode` varchar(5) NULL,
>        `city` varchar(35) NULL,
>        `hstate` varchar(45) NULL,
>        `exclusive` varchar(7) NULL,
>        `eventtime` time NULL DEFAULT current_time(),
>        `eventdate` date NULL DEFAULT current_date(),
>        `eventdura` varchar(35) NULL,
>        `daysevent` varchar(10) NULL,
>        `crowd` varchar(25) NULL,
>        `venue` varchar(50) NULL,
>        `activitytype` varchar(45) NULL,
>        `actdetails` varchar(255) NULL,
>        `encodedby` varchar(100) NULL,
>        `curmo` varchar(2) NULL,
>        `pageweb` varchar(50) NULL,
>        PRIMARY KEY (`pevent`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
>
> But this throws a syntax error. I have tried Now() as well.
>
> What am I doing wrong?
>
> Best,
>
> -Jason
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=maxb...@gmail.com
>
>

Reply via email to