Solved

create temporary table... insert...

Posted on 2003-12-11
2
1,139 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Creating and Managing Databases with phpMyAdmin in cPanel.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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