Solved

& Ampersand in MYSQL CANCAT()

Posted on 2009-07-15
4
946 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

740 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