Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Extracting The Filename from a path

Author  Topic 

scullee
Posting Yak Master

103 Posts

Posted - 2003-03-12 : 23:10:15
I am importing data from an email based interface. The clients email us the data they want to send as attachments to emails.

I have got SQL server reading the emails grabbing the attachments etc.

The next step is to process the files, the system has to call specific stored procedures based on the filenames that have been sent.

Is there an easy way to extract just the filename from the path or will have to do it manually but finding the last '\' and then grabbing the chars to the right of that?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-12 : 23:15:50
SELECT Reverse(Left(Reverse(pathname),CharIndex('\', Reverse(pathname))-1))
FROM myTable

Go to Top of Page
   

- Advertisement -