x

MYSQL Trimming Data until it hits a special character

Is there a way to trim all the characters before it hits a special character. For example the table has data such as "\SERVER01\printer01". I do not want to display \SERVER01\ The output i want is printer01

Please help!

more ▼

asked Nov 06, 2009 at 08:00 PM in Default

avatar image

tyou
11 1 1 1

Please note that thisforum is specifically for Microsoft SQL Server, so the folk here may not have good knowledge of MySQL

Nov 07, 2009 at 09:51 AM Kristen ♦
(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

            
select col,right(col,locate('\',reverse(col))-1) from your_table            
more ▼

answered Nov 09, 2009 at 04:52 AM

avatar image

Madhivanan
1.1k 2 5 9

(comments are locked)
10|1200 characters needed characters left

SELECT PARSENAME(REPLACE(Col1, '\', '.'), 1) FROM Table1

more ▼

answered Nov 10, 2009 at 07:33 AM

avatar image

Peso
1.6k 5 6 9

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x104

asked: Nov 06, 2009 at 08:00 PM

Seen: 2300 times

Last Updated: Nov 07, 2009 at 09:51 AM

Copyright 2016 Redgate Software. Privacy Policy