Solved

& Ampersand in MYSQL CANCAT()

Posted on 2009-07-15
4
958 Views
Last Modified: 2012-08-14
How do you escape a & ampersand in mySQL, I have something like the following but need to have a ampersand in the CONCAT(), I have tried escaping \ but that does not work.

SELECT modules.URLvalue, modules.filepath, modules.id, CONCAT( modules.URLvalue,'\&pgid',modules.id) AS link
0
Comment
Question by:dstubblefield65
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:pcelba
ID: 24863436
If it is URL I would try %26 instead of &. (I am too lazy to test it, MySql is not installed here, sorry.)
0
 

Author Comment

by:dstubblefield65
ID: 24863814
I tried the %26, also the & an neither worked, all i get with the %26 is %26
0
 
LVL 42

Accepted Solution

by:
pcelba earned 250 total points
ID: 24864263
What about CHAR() function?

SELECT modules.URLvalue, modules.filepath, modules.id, CONCAT( modules.URLvalue, CHAR(38), 'pgid', modules.id) AS link
0
 

Author Comment

by:dstubblefield65
ID: 24864543
That did the trick, hadn't thought of the ASCII character sets
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question