Heiko Stoermer wrote:
> AJDIN BRANDIC wrote:
> > Probably asked before but couldn't find the answer.
> > What I want to do is each time a record is added to my table, current
> > date and time should be added to the same record.
> > i.e.
> > insert into table mytable(id,name) values (1,'John Smith');
> > then select * from mytable;
> > should give me
> > 1, John Smith, 2000-07-24 11.30
> > How do I set date field to do so?
> I'm not sure, but I don't think that you can do this automatically. In
> other databases this would be achieved through stored procedures and
> triggers - but mysql has neither.
> what you can to is to expand your insert statement like this:
> insert into table mytable(id,name,datefield,timefield) values (1,'John
> this should work.
> heiko stoermer
What is wrong with a timestamp field?