SDU Tools: Extracting file path components in SQL Server T-SQL
Our free SDU Tools for developers and DBAs, now includes a very large number of tools, with procedures, functions, and views. One common request that we’ve had, is that users need to be able to extract the component parts of a file path.
In the example above, you’ll see that we have added a table-valued function called FilePathComponents.
It supports both drive paths and UNC paths.
In case, you need to process individual paths, to help with that, we’ve added a number of scalar functions: FilePathToFileName, FilePathToFolderName, FilePathToFileExtension. You can see them in action here:
2025-04-10