Bonjour,
J’ai par erreur compil avc un type de colonne Boolean, il faut que je passe en Varchar
le code que je fais ne passe pas…
[quote] for i = 1 to 31
SSPLiFEBD.SQLExecute “ALTER TABLE GXPIZER ALTER COLUMN REPOS”+str(i)+" TYPE VARCHAR"
SSPLiFEBD.Commit
next[/quote]
Savez vous comment faire …?
sqlite ne sait pas faire.
il faut copier dans une table temporaire avec les bonnes valeurs, puis supprimer l’ancienne table.
explications ici : (en bas de la page) https://sqlite.org/lang_altertable.html
[quote=337630:@Jean-Yves Pochez]sqlite ne sait pas faire.
il faut copier dans une table temporaire avec les bonnes valeurs, puis supprimer l’ancienne table.
explications ici : (en bas de la page) https://sqlite.org/lang_altertable.html[/quote]
merci…
@Jean-Yves Pochez
Merci, je suis bloqué sur la manière d’écrire cette partie…
5-Transférer le contenu de X dans new_X à l’aide d’une instruction comme: INSERT INTO new_X SELECT … FROM X.
j’essaie
Lets say, you have a table and need to rename “field-1” to “field-2”: First ==>> rename the old table:
ALTER TABLE original RENAME TO tmp;
Now create the new table based on the old table but with the updated column name:
==>> create a table with the updated columns
CREATE TABLE original(
field_a INT
, field_b INT
);
Then copy the contents across from the original table.
INSERT INTO origignal(field_a, field_b)
SELECT field_a, field_b
FROM tmp;
Lastly, drop the old table.
DROP TABLE tmp;
Un indispensable quand on travaille avec des bases SQLite:SQLiteStudio.