Posting Yak Master
Posted - 01/02/2013 : 11:12:13
I have a table which has one colunm containing a windows UNC path and file name. I'm trying to find the rows that have a valid file extension. I'm using the query below but its returning no results.
The issue must be the where clause and using patindex can anybody help me.
SELECT sUncPath ,
FileName = REVERSE(LEFT(REVERSE(sUncPath),
CHARINDEX('\', REVERSE(sUncPath), 1) - 1)) ,
SUBSTRING(sUncPath, PATINDEX('%.%', sUncPath) + 1, LEN(sUncPath)) AS Extention
FROM Files_And_folders WHERE PATINDEX('%.[a-z][a-z][a-z]%', sUncPath) = 0
Thank you in advance