views:

224

answers:

1

I have a resultset which has ProductURL stored :

accessoires/abc/285/P187654
accessoires/abc/285/D18765432
accessoires/abc/285/A1876543

I need to get the final part of the URL i.e. anything that is after the final '/' that appears in the URL.

I have a function which gives me the LASTINDEX :

SELECT [LAST_INDEX] (ProductURL,'/')

But how do I run a Select statment with this function inside a substring:

SELECT Substring(ProductURL,SELECT [LAST_INDEX] (ProductURL,'/'),len(ProductURL))
from data

This does not seem to work? Is there another way to do this?

+1  A: 

Just get rid of the SELECT:

SELECT  Substring(ProductURL, [LAST_INDEX] (ProductURL, '/'), len(ProductURL))
FROM    data
Quassnoi
oops ! lol this question should be deleted ! :)
Murtaza RC