Solved

Problem cutting off trailing backslash from field value in mysql

Posted on 2014-07-24
3
351 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 21

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 31

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now