tags:

views:

403

answers:

2

HI Guys,

Here I a wanna know that whether sqlite supports SELECT INTO statement.

Actually I am trying to save the data in my table1 into table2 as a backup of my database before modifying the data.

for that when I am using the SELECT INTO Statement a syntax error was generating as:

My query as:

SELECT * INTO equipments_backup FROM equipments;

"Last Error Message:near "INTO":syntax error".

Anyone's help will be appreciated.

Thank you, Monish.

+1  A: 

sqlite does not support SELECT INTO.

You can probably use this form instead:

INSERT INTO equipments_backup SELECT * FROM equipments;

nos
Ok Thank you NOS.I will try it.
monish
when i tried with ur advice its again generating an error as:Last Error Message:unable to open database file.
monish
Can't help you there, the above works for me. You'd get that error if you e.g. specify an invalid database file.
nos
Yup really thanks it was working fine.actually by mistake I opened nother database.
monish
Nother doubt i am having then how can I copy the contents in the table of one database into the table of nother database.will u pls help me in dis also.
monish
+2  A: 

Instead of

SELECT * INTO equipments_backup FROM equipments

try

CREATE TABLE equipments_backup AS SELECT * FROM equipments