登录
首页 » SQL » 在 SQL Server 中从完整路径提取文件名

在 SQL Server 中从完整路径提取文件名

于 2022-04-10 发布 文件大小:2.35 kB
0 126
下载积分: 2 下载次数: 1

代码说明:

翻译: maninwest@Codeforge 作者:OriginalGriff@CodeProject有时,我们需要从文件的完整路径中提取文件名 (有/无扩展名)。使用  C# 等很容易做到,只需使用 Path.GetFileName 方法即可。但是,如果在  SQL 中呢?我在磁盘中存储了一些图像,其路径在一个数据库表格中,为了便于演示,我需要在 SQL 中提取不带扩展名的文件名。我意识到需要多一些考虑。我没有使用查询或者写 SP 来返回我要的数据,我认为一个 SQL 函数可能有用。使用 SQL 函数将路径分成你可能需要的位。SQL四个函数:-- ============================================= -- Author: Paul Griffin -- Create date: 18 January 2015 -- Description: Returns a filename with extension -- from a full path: -- D:TempResourcesImagesMy.Picture.jpg -- ==> My.Picture.jpg -- ============================================= CREATE FUNCTION [dbo].[GetFileName] ( @Path NVARCHAR(MAX) ) RETURNS NVARCHAR(MAX) AS BEGIN DECLARE @FileName NVARCHAR(MAX) DECLARE @ReversedPath NVARCHAR(MAX) SET @ReversedPath = REVERSE(@Path)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Cash Coin rf
    cashshop file for rf
    2019-05-22 01:09:47下载
    积分:1
  • MySQL的最详细帮助文件
    MySQL的最详细帮助文件,对初学mysql的朋友具有一定的帮助
    2022-05-30 10:51:33下载
    积分:1
  • translate-data-using-expdp
    跨表空间传输用户数据,用expdp,impdp传输数据,且在传输的过程中更换表空间(translate data using expdp)
    2013-11-20 17:45:42下载
    积分:1
  • 将sql数据库中所有的表读出,并显示所有的字段,选者某个字段可以将该字段的内容保存为xml文件,xml文件读入到sql...
    将sql数据库中所有的表读出,并显示所有的字段,选者某个字段可以将该字段的内容保存为xml文件,xml文件读入到sql-To sql database table all read out and display all of the field, selected from a field and the content of this field can be saved as xml file, xml document read into sql
    2022-02-02 01:33:32下载
    积分:1
  • 学籍管理系统
    学籍管理系统 -expulsion Management System Status Management System Status Management System
    2022-07-03 13:29:21下载
    积分:1
  • informix 初始化数据库脚本
    linux下初始化informix 数据库,添加数据库表空间,db2 -290 处理办法(Linux initialization of Informix database, add database table space)
    2018-10-26 21:30:11下载
    积分:1
  • SQL2008inHyperV2008
    Running SQL Server 2008 in a Hyper-V Environment
    2014-05-01 13:12:58下载
    积分:1
  • 数据和代码
    MySQL创建表格并导入数据,导入的数据是CSV文件的格式。并且说明了如果报错说不能连接MySQL 服务器的情况,说明啦应该怎么解决这个问题。(MySQL creates tables and imports data in the form of CSV files. It also explains how to solve this problem if the error report says that MySQL server can not be connected.)
    2020-06-20 01:00:02下载
    积分:1
  • CreateWord
    将SQL数据库的结构输出为一个word文档,包括字段的名称、类型、长度等信息(SQL database structure will be output as a word document, including the field name, type, length and other information)
    2007-11-04 12:22:27下载
    积分:1
  • backup
    oracle 写的备份恢复工具, 备份时 cmd下输入bk 恢复时输入restore 帮助信息可查(oracle backup and recovery tools Backup under the cmd input bk Recovery when you enter the restore Help information can check)
    2012-05-09 23:35:20下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载