Mysql : insertion date automatique
Anaïs
-
fef -
fef -
Bonjour,
je dois créer une BDD sous Mysql qui concerne les informations sur des films.
Quand je créé un nouvel item, je voudrais qu'un champ se remplisse automatiquement avec la date du jour : DATEINSERTION.
Voici ma table actuelle :
CREATE TABLE FILM ( TITRE CHAR(70) NOT NULL,
RESUME CHAR(300),
ANNEESORTIE INT(4) NOT NULL,
GENRE CHAR(20),
DATEINSER DATE, // --> que faire pour que ce champ se remplisse automatiquement avec la date d'aujourd'hui ??
PRIMARY KEY (TITRE) );
Merci beaucoup.
PS: je suis débutante... :-D
je dois créer une BDD sous Mysql qui concerne les informations sur des films.
Quand je créé un nouvel item, je voudrais qu'un champ se remplisse automatiquement avec la date du jour : DATEINSERTION.
Voici ma table actuelle :
CREATE TABLE FILM ( TITRE CHAR(70) NOT NULL,
RESUME CHAR(300),
ANNEESORTIE INT(4) NOT NULL,
GENRE CHAR(20),
DATEINSER DATE, // --> que faire pour que ce champ se remplisse automatiquement avec la date d'aujourd'hui ??
PRIMARY KEY (TITRE) );
Merci beaucoup.
PS: je suis débutante... :-D
A voir également:
- Could not connect to mysql! please check your database settings!
- Borland database engine - Télécharger - Édition & Programmation
- Check disk - Guide
- Qwerty to azerty - Guide
- Please press del or f2 to enter uefi bios setting - Forum BIOS
- This is a system-generated message to inform you that your email could not be delivered to one or more recipients. details of the email and the error are as follows: ✓ - Forum Mail
3 réponses
Voilà un extrait sur le champ TIMESTAMP, on peut lui assigner une valeur d'auto-update. Extrait ci-dessous :
For one TIMESTAMP column in a table, you can assign the current timestamp as the default value and the auto-update value. It is possible to have the current timestamp be the default value for initializing the column, for the auto-update value, or both. It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.
Source : http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
For one TIMESTAMP column in a table, you can assign the current timestamp as the default value and the auto-update value. It is possible to have the current timestamp be the default value for initializing the column, for the auto-update value, or both. It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.
Source : http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
fef
As tu eu ta réponse ? J'ai le même soucis