Bonjour,
Je me retrouve avec le message d'erreur suivant "unsuccessful metadata updata object TEST_M is in use".
Voici les differentes operations que j'effectue:
Creation de ma table Maitre d'une clé primaire, et d'un champ unique.
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 IBSQL->SQL->Clear(); IBSQL->SQL->Add("CREATE TABLE TEST_M"); IBSQL->SQL->Add(" (NOM_M VARCHAR(50) NOT NULL,"); IBSQL->SQL->Add(" CODE_TEST_M INTEGER NOT NULL,"); IBSQL->SQL->Add(" VALEUR_M INTEGER)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining IBSQL->SQL->Clear(); IBSQL->SQL->Add("ALTER TABLE TEST_M ADD"); IBSQL->SQL->Add(" CONSTRAINT PK_TEST_M"); IBSQL->SQL->Add(" PRIMARY KEY (NOM_M)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining(); IBSQL->SQL->Clear(); IBSQL->SQL->Add("ALTER TABLE TEST_M"); IBSQL->SQL->Add(" ADD CONSTRAINT U_TEST_M"); IBSQL->SQL->Add(" UNIQUE (CODE_TEST_M)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining(); IBSQL->Close();
Creation de ma table esclave d'une clé primaire, et d'un champ unique.
et maintenat au moment de créer ma FOREIGN KEY...
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 IBSQL->SQL->Clear(); IBSQL->SQL->Add("CREATE TABLE TEST_E ("); IBSQL->SQL->Add("CODE_TEST_M INTEGER NOT NULL, "); IBSQL->SQL->Add("NOM_E VARCHAR(50) NOT NULL, "); IBSQL->SQL->Add("CODE_TEST_E INTEGER NOT NULL, "); IBSQL->SQL->Add("VALEUR_E INTEGER)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining(); IBSQL->SQL->Clear(); IBSQL->SQL->Add("ALTER TABLE TEST_E"); IBSQL->SQL->Add(" ADD CONSTRAINT PK_TEST_E"); IBSQL->SQL->Add(" PRIMARY KEY (CODE_TEST_M, NOM_E)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining(); IBSQL->SQL->Clear(); IBSQL->SQL->Add("ALTER TABLE TEST_E"); IBSQL->SQL->Add(" ADD CONSTRAINT U_TEST_E"); IBSQL->SQL->Add(" UNIQUE (CODE_TEST_E)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining();
Je me retrouve avec l'erreur de ci dessus. Je n'y comprend rien.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 IBSQL->SQL->Clear(); IBSQL->SQL->Add("ALTER TABLE TEST_E"); IBSQL->SQL->Add(" ADD CONSTRAINT FK_TEST_E"); IBSQL->SQL->Add(" FOREIGN KEY (CODE_TEST_M)"); IBSQL->SQL->Add(" REFERENCES TEST_M (CODE_TEST_M)"); IBSQL->ExecQuery(); IBSQL->Transaction->CommitRetaining();
Avez vous une idée ???
Merci d'avance.
Partager