MySQL & default value

admin

Administrator
Staff member
create table temp(id int not null auto_increment primary key,
nimi text,
aeg datetime default 'NOW()');

and

INSERT INTO temp (nimi) VALUES('test');
gives me

SELECT * FROM temp;
+----+------+---------------------+
| id | nimi | aeg |
+----+------+---------------------+
| 1 | test | 0000-00-00 00:00:00 |
+----+------+---------------------+
How is possible to make that when I insert something automaticalli adds current time into column aeg
 
Back
Top