I have done some research, but I have been unable to do/find how to put the two together.
I am trying to get the filename from a field known as doc_filename, minus any document path and extension, for example "docs\00010\filename.doc"
should be just be "filename"
.
This has worked to remove the path name, however the extension remains. How do I remove this?
Thanks
SELECT (case when doc_filename like '%\%' then
LTRIM(
RTRIM(
REVERSE(
SUBSTRING(
REVERSE(doc_filename),0, CHARINDEX('\', REVERSE(doc_filename),0)
)
)
)
)
else ''
end)
FROM documents