Solved

# Problem cutting off trailing backslash from field value in mysql

Posted on 2014-07-24
356 Views
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
Question by:butterhook

LVL 22

Assisted Solution

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\\');

0

LVL 32

Accepted Solution

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

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

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

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.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

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

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

#### Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!