This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes problem with inser into query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "problem with inser into query " Watch "problem with inser into query " New topic
Author

problem with inser into query

sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
Dear friends,
I have a table with column titles as: (id, price,quality,deadline,UtilityValue,sellerNumber) which Id is an AUTO_INCREMENT!
now I want to copey this table to another table with the exact same column titles. till here every thing is ok! but I DONT want to copy the id field. what I want is that I copy the data of each row except id which should be filled AUTO_INCREMENTAly.
so I write below code:



and I get this error:


I guess it error is related to the id column which I didn't mentioned in insert into query. Am I right? If yes Do you know how can I correct it?
Thank you sooo much!
SAhar.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3673

Which DB are you using? For MySQL check this
You might need to specify the required field of both tables in the query. Haven't tried this recently so can't remember exactly


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: problem with inser into query
 
Similar Threads
Data truncation: Data too long for column 'session_id' at row 1
Slow Queries
SQLException:Column count doesn't match value count at row 1
Problem in <one-to-one> relation mapping
phpbb2jforum problem: Data too long for column 'user_timezone'