MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old May 2nd, 2008, 08:13 PM
ars_moriendi ars_moriendi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 ars_moriendi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 59 sec
Reputation Power: 0
Question Bad insert syntax?

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

Reply With Quote
  #2  
Old May 2nd, 2008, 08:26 PM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2003
Posts: 1,158 MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level)MrFujin User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 15 h 35 m 28 sec
Reputation Power: 216
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','') 

Reply With Quote
  #3  
Old May 2nd, 2008, 08:32 PM
ars_moriendi ars_moriendi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 ars_moriendi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 59 sec
Reputation Power: 0
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:
Originally Posted by MrFujin
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','') 

Reply With Quote
  #4  
Old May 2nd, 2008, 09:41 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,727 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 19 h 22 m 42 sec
Reputation Power: 848
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
__________________
r937.com | rudy.ca

Reply With Quote
  #5  
Old May 2nd, 2008, 09:47 PM
ars_moriendi ars_moriendi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 ars_moriendi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 59 sec
Reputation Power: 0
Wait a minute!
Backticks around everything or just the table name?


Quote:
Originally Posted by r937
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

Reply With Quote
  #6  
Old May 2nd, 2008, 09:53 PM
ars_moriendi ars_moriendi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 4 ars_moriendi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 59 sec
Reputation Power: 0
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:
Originally Posted by r937
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

Reply With Quote
  #7  
Old May 2nd, 2008, 10:02 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,727 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 19 h 22 m 42 sec
Reputation Power: 848

Reply With Quote
  #8  
Old May 3rd, 2008, 06:32 AM
pgFrank's Avatar
pgFrank pgFrank is offline
So help me Codd
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Location: Brazil
Posts: 126 pgFrank User rank is Sergeant (500 - 2000 Reputation Level)pgFrank User rank is Sergeant (500 - 2000 Reputation Level)pgFrank User rank is Sergeant (500 - 2000 Reputation Level)pgFrank User rank is Sergeant (500 - 2000 Reputation Level)pgFrank User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 16 h 30 m 42 sec
Reputation Power: 18
Quote:
INSERT INTO 20080502
It's not allowed to start with numbers in a table name nor numbers only.

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.
Comments on this post
shammat agrees!
__________________
PostgreSQL-manual

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Bad insert syntax?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway