[Solved] How I can clone mysql table? lazarus / 16-Databases ---------------------------------------------------------------------- Fossy · 2015-04-24 11:04 Hello!! I'm trying to clone table with Query (TSQLQuery), using freepascal text mode. I can make "Select..." querys but I have error when I try make clone table like this: .... query.close; query.sql.text:='CREATE TABLE '+usuario+' AS SELECT * FROM ejemplo'; query.open; ...... And I get: An unhandled exception occurred at $0000000000450D55 : EDatabaseError : Cannot open a non-select statement $0000000000450D55 $0000000000454212 $0000000000471B2F $000000000042D10F Please, how I can clone mysql table with freepascal?. Thanks!!. ---------------------------------------------------------------------- rvk · 2015-04-24 11:25 Quote from: Fossy on April 24, 2015, 01:04:30 pmAn unhandled exception occurred at $0000000000450D55 : EDatabaseError : Cannot open a non- select statement $0000000000450D55 $0000000000454212 $0000000000471B2F $000000000042D10F The message already says what the problem is. query.Open needs to have a result-set. Your CREATE-command does not give any result-set back (and shouldn't). When you're doing a CREATE, DELETE, UPDATE and INSERT in SQL you need to use query.ExecSQL; Only when you have a SELECT (which does give a result-set back) you can use query.Open. You can read about it here: http://wiki.freepascal.org/SqlDBHowto/nl#Hoe_voer_je_een_query_uit_met _een_TSQLQuery.3F ---------------------------------------------------------------------- Fossy · 2015-04-28 09:11 Thanks rvk!! Works perfectly . Thanks!!!!