At 9:30 PM -0300 3/13/07, allysonalves wrote:
Hi everybody
Has some way to set up a function, like now(), as a default value of
an dateTime column.
Is some thing like this.
Create Table Persons (
PersonCode int(10) zerofill not null auto_increment,
PersonName varchar(150) not null,
CadastreDate DateTime not null default now(),
Primary Key (PersonCode)) Engine=MyIsam
I am not want to transfer the responsibility of populate
CadastreDate column to layers up.
Who is the best solution ?
Allyson Roberto Alves Cavalcanti
in Mysql >= 4.1, you can use a non-updating timestamp:
create table Persons (
...
CadastreDate timestamp default current_timestamp,
...
unlike older timestamp types, this will not change if the record is
updated. That behavior can be replicated via for example:
CadastreDate timestamp default current_timestamp on update
current_timestamp
See
http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html
- steve
--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center [EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]