Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

Problem cutting off trailing backslash from field value in mysql

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
butterhook
Asked:
butterhook
2 Solutions
 
Kim WalkerWeb Programmer/TechnicianCommented:
Change the backticks to quotes and the bottom one should work.
SELECT TRIM(TRAILING '\\' FROM 'C:\\path\\to\\somewhere\\');

Open in new window

0
 
awking00Commented:
Try this possible workaround -
select trim(trailing char(92)  from 'c:\path\to\somewhere\'
0
 
butterhookAuthor Commented:
Both these appear to work! Thanks both
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now