|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
This should be easy, but if it were easy, I wouldn't be having these problems.
I'm trying to do a basic MySQL insert in this format, but it's erroring out. Can anyone tell me what I'm doing wrong? Code:
INSERT INTO 20080502 (ORDER_NUMBER,ITEM_SKU,ITEM_QUANTITY,FIRST_NAME,LAST_NAME,COMPANY,ADDRESS1,ADDRESS2,CITY,STATE,POSTA L_CODE,COUNTRY,SHIPPING,EMAIL,PHONE,COMMENTS) VALUES ('809292929','BB002','4','Tyler','Durden','Paper Street Soap Company','553 Paper Street','','Omaha','NE','44849','UNITED STATES OF AMERICA','USP1CL','tyler@alternium.net','(727) 666-6666','')
For what it's worth, the spaces in POSTAL_CODE aren't in the actual query. I'm not sure why it's showing up that way. Last edited by ars_moriendi : May 2nd, 2008 at 08:15 PM. Reason: mistype |
|
#2
|
||||
|
||||
|
what type is POSTAL_CODE ? if it is a number there shouldn't be placed ' ' around the value, which will make the sql like this:
Code:
INSERT INTO 20080502 (ORDER_NUMBER,ITEM_SKU,ITEM_QUANTITY,FIRST_NAME,LAST_NAME,COMPANY,ADDRESS1,ADDRESS2,CITY,STATE,POSTA L_CODE,COUNTRY,SHIPPING,EMAIL,PHONE,COMMENTS) VALUES ('809292929','BB002','4','Tyler','Durden','Paper Street Soap Company','553 Paper Street','','Omaha','NE',44849,'UNITED STATES OF AMERICA','USP1CL','tyler@alternium.net','(727) 666-6666','')
|
|
#3
|
|||
|
|||
|
Everything's VarChar of varying sizes.
Your comment did give me an idea, but I went all the way down to one variable like so: Code:
INSERT INTO 20080502 (ORDER_NUMBER) VALUES ('8092929290')
In this case, ORDER_NUMBER is VarChar (10). Still didn't work. Quote:
|
|
#4
|
||||
|
||||
|
oh, i love the "guess the error message" game, can i play?
put backticks around your table name if that's not it, i give up maybe you will ahve to tell us the error message after all |
|
#5
|
|||
|
|||
|
Wait a minute!
Backticks around everything or just the table name? Quote:
|
|
#6
|
|||
|
|||
|
Well, you're probably not literally a saint, but you're just next to one in my book. The backticks did it. Let me know if there's any "karma" type thing I can allocate to you. I really, really, really appreciate the help.
Quote:
|
|
#7
|
||||
|
||||
![]() |
|
#8
|
||||
|
||||
|
Quote:
And also, 20080502 sounds like a date, the second of May 2008. If that's the case, your data model is wrong. You should never have a table per day, only one table with all dates should do the job. A couple of million, billion or even zillion records shouldn't be a problem. So, why do you need a bad name like this ? And backticks are eval.
__________________
PostgreSQL-manual |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Bad insert syntax? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|