Extracting the filename from a full path in SQL Se
2016-08-23
0 0 0
no vote
Other
Earn points
Translated by maninwest@Codeforge Author:OriginalGriff@CodeProject
Sometimes, you want to extract the filename (with or without the extension) from the full path of a file. It's easy in C# and so forth - just use the Path.GetFileName method. But what if you want it in SQL?
I store images on disk, and the path to the images in a database table - and for presentation reasons I needed to extract the filename without the extension in SQL, but realised it takes a little thinking about. So rather than do it "in line" in a query, or write an SP to return just the data I wanted, I thought an SQL Function would be useful.So...SQL functions to break up the path into the bits you might need.
SQL
Four functions (the name is descriptive and the comments provide the detail):
-- ============================================= -- Author: Paul Griffin -- Create date: 18 January 2015 -- Description: Retur
others
sqlserver
提取
路径
完整
文件名
Related Source Codes
Simple hotel management system source code
0
0
no vote
Online examination system
0
0
no vote
Path planning code
0
0
no vote
A path planning algorithm for sweeping robot
0
0
no vote
Fast matching path planning
0
0
no vote
No comment