Solved

create temporary table... insert...

Posted on 2003-12-11
2
1,142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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