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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select data

Status
Not open for further replies.

newssis

MIS
Dec 18, 2008
13
US
Hi all,

I have data in table like this :

c:/file/datapart/datafile/filename.xls

and only want to return filename.xls or any other file extension but not whole path.

how can i do that.

Thanks
Pat
 
Try this
Code:
DECLARE @t TABLE (PathColumn VARCHAR(100))
INSERT INTO @t SELECT 'c:/file/datapart/datafile/filename.xls'

SELECT REVERSE(LEFT(REVERSE(PathColumn), CHARINDEX('/', REVERSE(PathColumn)) - 1)) FROM @t
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top