This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes SQL quotation question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL quotation question" Watch "SQL quotation question" New topic
Author

SQL quotation question

Werner Fletcher
Ranch Hand

Joined: Apr 19, 2011
Posts: 34
Hey all,

I'm trying to insert this into a table from the MySQL command line: Quote for the day: "bla bla bla"
This is the line I'm using: INSERT INTO table VALUES('Quote for the day: '"bla bla bla"'');

This is not working for me... any help?

Thanks
Werner Fletcher
Ranch Hand

Joined: Apr 19, 2011
Posts: 34
Ok, I accidentally clicked the freaking "Solved" button

What I mean is that I'm not getting the " " around my quote.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Don't worry about the solved button.

It looks like you have nested single quotes. You need to escape them so the database can see them. In most databases, you write the ' symbol an extra time.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: SQL quotation question
 
Similar Threads
change email format from abc@bla.com to a name
mysql help
Empty space caused by rendered attribute
Happy New Year
Writing the choices.txt