CHARINDEX or Substring help

  • If I have the following:

    D:\ArchivedRecordings\From_DEFR4C7K1OP01\2004141507_2004141489_eed88bc8da41c8e458777675.xml

    How can I get just the filename (2004141507_2004141489_eed88bc8da41c8e458777675.xml) extracted out of that?

    Any and all help will be greatly appreciated, this is driving me insane!!!

    Thank You!!

  • DECLARE @filepath VARCHAR(1000)

    SET @filepath = 'D:\ArchivedRecordings\From_DEFR4C7K1OP01\2004141507_2004141489_eed88bc8da41c8e458777675.xml '

    SELECT REVERSE(LEFT(REVERSE(@filepath),CHARINDEX('\', REVERSE(@filepath), 1) - 1)) as filedetails

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply