Solved

& Ampersand in MYSQL CANCAT()

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Online Forms 6 65
How Resolve Word 2011 Office-Database Error in Mac OS X 10 81
Access Importing Table Query With Specific Timestamp Daily 2 33
corrupt Databases 9 63
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

808 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