Solved

# Problem cutting off trailing backslash from field value in mysql

Posted on 2014-07-24
358 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

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.
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…