Solved

create temporary table... insert...

Posted on 2003-12-11
2
1,135 Views
Last Modified: 2008-02-01
Im trying to create a temporary table as a select statement, then sequentially insert stuff as one prepared statement..

CREATE TEMPORARY TABLE AAAA as (SELECT.....); INSERT INTO AAAA ....;

but it wont get past the first ";"

If I run the first statement alone it works fine..
0
Comment
Question by:illucid
2 Comments
 

Expert Comment

by:johnbisounours
ID: 9919120
you simply can not

your front-end language (ADO etc) for sure doesn't allow for multiple statements

you can just do this in sequence, as "prepared statements" have no sense in MySql and Oracle if the cache stuff is working properly (MySql 4+)

CREATE TEMPORARY TABLE AAAA SELECT * FROM .... WHERE ...;
INSERT INTO AAAA VALUES(...);
INSERT INTO AAAA VALUES(...);
INSERT INTO AAAA VALUES(...);
0
 
LVL 4

Accepted Solution

by:
ElectroNitz earned 125 total points
ID: 9920760
You can build a single INSERT to insert multiple records, but you will have to send the CREATE and INSERT separately.

INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)

http://www.mysql.com/doc/en/INSERT.html
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now