The following code will do the task:
DECLARE @file VARCHAR(200) = 'c:\temp\data\log.txt' SELECT REVERSE(LEFT(REVERSE(@file), CHARINDEX('\', REVERSE(@file), 1) - 1)) AS [FileName] SELECT LEFT(@file, LEN(@file) - CHARINDEX('\', REVERSE(@file), 1) + 1) AS [Path]
No comments:
Post a Comment