This is a discussion on Automatic date setting within the MySQL Database forums, part of the Database Forums category; Hi, I'm looking fo a way to make possible to automatic set the date at the creation of a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'm looking fo a way to make possible to automatic set the date at the creation of a row! for exemple: CREATE TABLE News ( IDNews int(10) NOT NULL, Argument int(3) references ArgomentoNews(IDArgomento) on delete set null, Title varchar(50) NOT NULL, Body varchar(1000) NOT NULL, publish_date date, Autor varchar(20) references Utente(NomeUtente) on delete set null, PRIMARY KEY (IDNews) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; I'd like that when I insert a News into the database the field 'publish_date' is automatically set to the date of the insertion! Do you know a way? thanks! |
|
|||
|
Freedom wrote:
> Hi, > I'm looking fo a way to make possible to automatic set the date at the > creation of a row! > > for exemple: > > CREATE TABLE News ( > IDNews int(10) NOT NULL, > Argument int(3) > references ArgomentoNews(IDArgomento) > on delete set null, > Title varchar(50) NOT NULL, > Body varchar(1000) NOT NULL, > publish_date date, > Autor varchar(20) > references Utente(NomeUtente) > on delete set null, > PRIMARY KEY (IDNews) > ) ENGINE=InnoDB DEFAULT CHARSET=latin1; > > I'd like that when I insert a News into the database the field > 'publish_date' is automatically set to the date of the insertion! > > Do you know a way? > > thanks! Take a look at http://dev.mysql.com/doc/refman/5.0/...stamp-4-1.html |
|
|||
|
On 2006-12-06 20:15:19 +0100, "Paul Lautman"
<paul.lautman@btinternet.com> said: > Freedom wrote: >> Hi, >> I'm looking fo a way to make possible to automatic set the date at the >> creation of a row! >> >> for exemple: >> >> CREATE TABLE News ( >> IDNews int(10) NOT NULL, >> Argument int(3) >> references ArgomentoNews(IDArgomento) >> on delete set null, >> Title varchar(50) NOT NULL, >> Body varchar(1000) NOT NULL, >> publish_date date, >> Autor varchar(20) >> references Utente(NomeUtente) >> on delete set null, >> PRIMARY KEY (IDNews) >> ) ENGINE=InnoDB DEFAULT CHARSET=latin1; >> >> I'd like that when I insert a News into the database the field >> 'publish_date' is automatically set to the date of the insertion! >> >> Do you know a way? >> >> thanks! > > Take a look at > http://dev.mysql.com/doc/refman/5.0/...stamp-4-1.html thanks |