?
Solved

Problem cutting off trailing backslash from field value in mysql

Posted on 2014-07-24
3
Medium Priority
?
374 Views
Last Modified: 2014-07-28
Hi there

Trying to do something to manipulate a path e.g.

pathid pathlocation

1  c:\path\to\somewhere\
2 c:\path\to\somewhere\

How can I cut the trailing slash as it's an escaping character??

I'm trying this:

SELECT TRIM(TRAILING `n` FROM `bunion`);
and getting 'bunio'

But if I try this:

SELECT TRIM(TRAILING `\` FROM 'C:\path\to\somewhere\');

It doesn't even run

And nor does this:

SELECT TRIM(TRAILING `\\` FROM 'C:\\path\\to\\somewhere\\');

Any ideas???
0
Comment
Question by:butterhook
[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
3 Comments
 
LVL 22

Assisted Solution

by:Kim Walker
Kim Walker earned 750 total points
ID: 40216907
Change the backticks to quotes and the bottom one should work.
SELECT TRIM(TRAILING '\\' FROM 'C:\\path\\to\\somewhere\\');

Open in new window

0
 
LVL 32

Accepted Solution

by:
awking00 earned 750 total points
ID: 40220230
Try this possible workaround -
select trim(trailing char(92)  from 'c:\path\to\somewhere\'
0
 
LVL 1

Author Closing Comment

by:butterhook
ID: 40223622
Both these appear to work! Thanks both
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 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