On Dec 31, 2012, at 12:57 AM, Simon Slavin <slav...@bigfraud.org> wrote:

> 
> On 31 Dec 2012, at 8:54am, Igor Korot <ikoro...@gmail.com> wrote:
> 
>> I simply forgot to do it on the table creation. And now the table has
>> many rows...
> 
> You can easily modify a TABLE definition or even an entire database by using 
> the SQLite shell tool to dump the database as text file of SQL commands, then 
> edit the text file using a text editor, then use the same shell tool to read 
> the text file back in again.


Or, if you want to do it "live:" use ALTER TABLE to rename the existing table, 
CREATE TABLE to make the table with the FK you want, INSERT SELECT to bring the 
records from the renamed table to the new table, and DROP TABLE to get rid of 
the renamed original.


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to