Le 10/02/2012 18:30, Lucien RUBEMPRE a écrit :
/Le 10/02/2012 14:02, Bernard Ribot a écrit :/
/Le 10/02/2012 13:11, Lucien RUBEMPRE a écrit :
/
//Le 10/02/2012 09:44, Bernard Ribot a écrit :/
/
//
Je pense qu'il faut faire un ALTER TABLE ALTER COLUMN via l'éditeur SQL (Outils > SQL).

Bernard /

/
/J'ai tenté ceci :
/
/ALTER TABLE t_pays ALTER COLUMN ClairPays UNIQUE KEY `ClairPays` (`ClairPays`)
/
/et j'obtiens cela :

/
/You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNIQUE KEY `ClairPays` (`ClairPays`)' at line 1
/
/Alors, j'ai peut-être pas bien compris ta solution ?
/
/En supposant que c'est une base HSQLDB (SGBD intégré à OOo) la syntaxe est la suivante : ALTER TABLE "nom_table" ADD CONSTRAINT "nom_contrainte" UNIQUE ("ClairPays")
nom_contrainte est un nom choisi par toi, par exemple : c_ClairPays

Bernard
/
En fait c'est une base avec un moteur MySQL (JDBC).

--
Ma config. : W7 FP - SP1 64 bits | AMD Athlon(tm) II X4 645 3.10 GHz | RAM 8 Go
Libre Office 3.4.5 OOO340m1 (Build:502)

Ça marche aussi avec MySQL (je l'ai essayé aussi). Il n'y a pas besoin des guillemets :
ALTER TABLE nom_table ADD CONSTRAINT  nom_contrainte  UNIQUE (ClairPays)
--

Bernard Ribot
LibreOffice.org 3.5.0rc3 / Windows 7 SP1
LibreOffice.org 3.3.4 / Windows XP SP3
--
------------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@fr.openoffice.org
For additional commands, e-mail: sy...@fr.openoffice.org with Subject: help

Répondre à