Mysql : insertion date automatique

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
Configuration: Windows XP
Firefox 3.0.6

3 réponses

  1. 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
    1. As tu eu ta réponse ? J'ai le même soucis
  2. Regarde du coté des triggers -> http://dev.mysql.com/doc/refman/5.0/fr/create-trigger.html
    1. dans ta requette d'insertion tu mets
      INSERT INTO ...........DATEINSER=NOW().....