We help IT Professionals succeed at work.
Get Started

SQL Select INTO query doesn't work

James Coats
James Coats asked
on
3,222 Views
Last Modified: 2012-04-23
I am using phpMyAdmin to develop a database. I have two tables named:

press1_parameters

sheet2

Sheet2 is data imported from an Open Office excel sheet.

Both sheet2 and press1_parameters have the same column names set to the same data types as below:

Table: sheet2

Date (is not a data type just input data)
Product
Plys
Speed
Catalyst
Zone_Temps
Kws
BTU
WireTemps
Ambient
GluePumpSp
Spread
Chisel_Grade

Table: press1_parameters

PWC_1 (Primary Key)
Date (is not a data type just input data)
Product
Plys
Speed
Catalyst
Zone_Temps
Kws
BTU
WireTemps
Ambient
GluePumpSp
Spread
Chisel_Grade
Index

All data types in both tables are “varchar”

I need to move all the data in table “sheet2” into table “press1_parameters”


I am using the following SQL statement:

SELECT * FROM `sheet2`

INTO press1_parameters

I get the following error:

#1327 Undeclared variable: press1_parameters

I can use the Select * statement and get all the data from either table but when I use it as above I get the aforementioned error

I also tried the following and it works until I use the INTO command after the FROM command

SELECT`Date`, `Product`, `Plys`, `Speed`, `Catalyst`, `Zone_Temps`, `KWs`, `BTU`, `WireTemps`, `Ambient`, `GluePumpSp`, `Spread`, `Chisel_Grade`, `Notes`

FROM sheet2

INTO press1_parameters

I get the same error:

#1327 Undeclared variable: press1_parameters

I have also tried the following and still get the same error

SELECT`Date`, `Product`, `Plys`, `Speed`, `Catalyst`, `Zone_Temps`, `KWs`, `BTU`, `WireTemps`, `Ambient`, `GluePumpSp`, `Spread`, `Chisel_Grade`, `Notes`

FROM sheet2

INTO press1_parameters

VALUES

`Date`, `Product`, `Plys`, `Speed`, `Catalyst`, `Zone_Temps`, `KWs`, `BTU`, `WireTemps`, `Ambient`, `GluePumpSp`, `Spread`, `Chisel_Grade`, `Notes`

I am still new to SQL so any suggestions would be helpful.
Comment
Watch Question
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE