salut j'ai rélisé une base de données ne comportant que 4 tables
voila le code
le prob c'est que, lors de d'execution du fichier .sql dans PHPMyAdmin, une erreur apparait pour la derniere "alter table"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 /*==============================================================*/ /* Nom de SGBD : MySQL 4.0 */ /* Date de création : 21/05/2006 00:34:28 */ /*==============================================================*/ /*==============================================================*/ /* Table : ARCHIVAGE_DEVIS */ /*==============================================================*/ create table ARCHIVAGE_DEVIS ( ID_DEVIS int not null, DEVIS_SAVED text, primary key (ID_DEVIS) ) type = InnoDB; /*==============================================================*/ /* Table : ARCHIVAGE_FACTURE */ /*==============================================================*/ create table ARCHIVAGE_FACTURE ( ID_FACTURE char(10) not null, FACTURE_SAVED text, primary key (ID_FACTURE) ) type = InnoDB; /*==============================================================*/ /* Table : ARCHIVAGE_LG_DEVIS */ /*==============================================================*/ create table ARCHIVAGE_LG_DEVIS ( NUM_ARTICLE int not null, ID_DEVIS int not null, LG_DEVIS_SAVED text, primary key (NUM_ARTICLE) ) type = InnoDB; /*==============================================================*/ /* Index : RELATION_2_FK */ /*==============================================================*/ create index RELATION_2_FK on ARCHIVAGE_LG_DEVIS ( ID_DEVIS ); /*==============================================================*/ /* Table : ARCHIVAGE_LG_FACTURE */ /*==============================================================*/ create table ARCHIVAGE_LG_FACTURE ( NUM_ARTICLE_FAC int not null, ID_FACTURE int not null, LG_FACTURE_SAVED text, primary key (NUM_ARTICLE_FAC) ) type = InnoDB; /*==============================================================*/ /* Index : RELATION_1_FK */ /*==============================================================*/ create index RELATION_1_FK on ARCHIVAGE_LG_FACTURE ( ID_FACTURE ); alter table ARCHIVAGE_LG_DEVIS add constraint FK_RELATION_2 foreign key (ID_DEVIS) references ARCHIVAGE_DEVIS (ID_DEVIS) on delete restrict on update restrict; alter table ARCHIVAGE_LG_FACTURE add constraint FK_RELATION_1 foreign key (ID_FACTURE) references ARCHIVAGE_FACTURE (ID_FACTURE) on delete restrict on update restrict;
____________________________________________________________________________
Erreur
requête SQL:
ALTER TABLE ARCHIVAGE_LG_FACTURE ADD CONSTRAINT FK_RELATION_1 FOREIGN KEY ( ID_FACTURE ) REFERENCES ARCHIVAGE_FACTURE( ID_FACTURE ) ON DELETE RESTRICT ON UPDATE RESTRICT ;
MySQL a répondu:![]()
#1005 - Can't create table '.\hexa_facture\#sql-ac0_f3.frm' (errno: 150)
_____________________________________________________________________________
![]()
![]()
Partager