sqlite3 UNIQUE entfernen

Tags: sqlite3

Bei Stackoverflow fand ich die Antwort auf die Frage "Wie entferne ich das UNIQUE Flag von Felder in sqlite3 Tabellen?"

SQLite does not support the alter table drop constraint command. You will need to create a new table without a constraint, transfer the data, then delete the old table. I think something like the following should work:

CREATE TABLE child2 ( id INTEGER PRIMARY KEY, parent_id INTEGER, description TEXT ); 
    INSERT INTO child2 (id, parent_id, description) 
    SELECT id, parent_id, description FROM CHILD; 
DROP TABLE child; 
ALTER TABLE child2 RENAME TO child; 

You could also leave out parent_id from all the statements above if you don't want it transferred.

Kommentare (0)

Dieser Thread wurde geschlossen.


  • Fotografie (3)
  • django (3)
  • python (2)
  • linux (2)
  • Photoshop (2)
  • syncdb (1)
  • jquery (1)
  • django_evolution (1)
  • easy_install (1)
  • sqlite3 (1)

  • Social Kram