On 11/6/07, Valerio Bontempi <[EMAIL PROTECTED]> wrote: > Hi Kees, > > thanks for your solution, it is a very interesting solution. > But I need to rename a table using sql from php. > (this is also the reason for my need of sqlite and not sqlite3, not > supported yet by php) > > Thanks a lot > > Valerio >
Use the SQL suggested below in your PHP program. Don't worry about sqlite3 (that is all I have). Just change that to sqlite, and it should work. Lucknow:~/Data/punkish punkish$ sqlite3 foo SQLite version 3.4.2 Enter ".help" for instructions sqlite> CREATE TABLE foo (a, b); sqlite> .s CREATE TABLE foo (a, b); sqlite> INSERT INTO foo VALUES (1, 'blah'); sqlite> INSERT INTO foo VALUES (2, 'booh'); sqlite> SELECT * FROM foo; 1|blah 2|booh sqlite> BEGIN TRANSACTION; sqlite> CREATE TEMPORARY TABLE foo_backup (a, b); sqlite> INSERT INTO foo_backup SELECT a, b FROM foo; sqlite> DROP TABLE foo; sqlite> CREATE TABLE bar (a, b); sqlite> INSERT INTO bar SELECT a, b FROM foo_backup; sqlite> DROP TABLE foo_backup; sqlite> COMMIT; sqlite> SELECT * FROM bar; 1|blah 2|booh sqlite> .s CREATE TABLE bar (a, b); sqlite> .q ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------