Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSTR from right to left?

Status
Not open for further replies.

JohnnyRocket

Programmer
Joined
Dec 16, 2001
Messages
3
Location
CA
I have a column with filenames formatted like blah/blah/blah/filename.txt

I just want to display "filename.txt"

I have started with:

SELECT right(Parameters, instr(Parameters,'/'))
From Table

Obviously this only removes the first path name. Does anyone know how I can get INSTR to read from right to left (or any other method of solving this) so I can isolate the location of the last '/'

 
This works in VB. I don't know about SQL. Hope it helps.

SELECT right(Parameters, Len(parameters) - instrrev(Parameters,'/'))
From Table
 
Hi.
Try this:
select right(parameters,charindex('/',reverse(parameters))-1)
from table
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top