?
Solved

create temporary table... insert...

Posted on 2003-12-11
2
Medium Priority
?
1,150 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 375 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

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

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…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

840 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