Solved

Problem cutting off trailing backslash from field value in mysql

Posted on 2014-07-24
3
358 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
3 Comments
 
LVL 22

Assisted Solution

by:Kim Walker
Kim Walker earned 250 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 250 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

810 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