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

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

于 2022-04-10 发布 文件大小:2.35 kB
0 83
下载积分: 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 个回复

  • 学生管理系统
    此程序为学生管理系统。利用现在java和access相结合
    2022-01-26 08:28:17下载
    积分:1
  • in powerbuilder Database Backup and restore databases and source code examples
    在powerbuilder中备份数据库,恢复数据库及例子源代码-in powerbuilder Database Backup and restore databases and source code examples
    2022-12-11 13:35:03下载
    积分:1
  • inserts
    Emplos de insert en el motor de base de datos MySQL
    2014-12-21 12:30:57下载
    积分:1
  • AP_
    可以随时导出供应商详细资料,包括供应商名、税码、税务号等信息(You can always export supplier details, including vendor name, tax code, tax number and other information)
    2014-02-09 10:19:46下载
    积分:1
  • DotLucentet,用来做撬,使用。 之前是Java的程序,现在改用》net来做的。...
    DotLucentet,用来做撬,使用。 之前是Java的程序,现在改用》net来做的。 -DotLucentet used in making a crowbar use. Java before the procedure is now moving to a "net very consistent.
    2023-08-03 14:05:04下载
    积分:1
  • Baidu-database-middle-layer
    百度数据库中间层讲的主要有 MySQL数据库集群面临的问题 数据库中间层整体设计 数据库中间层主要功能模块和策略 数据库中间层应用 数据库中间层发展(Baidu middle layer of the main MySQL cluster problems The overall design of the middle layer of the Database middle layer main function modules and strategies Database middle tier application Database middle tier development)
    2017-05-11 19:40:36下载
    积分:1
  • VS2010_mfc_sql_server_task
    教材订购系统,含VS2010的MFC机制,使用ADO接口连接数据库,换机器运行需修改ADOConn.cpp文件参数;含mdf和ldf文件,SQL SERVER2008点击附加即可。(Textbook ordering system, the VS2010 MFC mechanism, using the ADO interface to connect to the database, and other machine running need modify ADOConn.cpp file parameters containing mdf and ldf files, SQL SERVER2008 click on the additional can.)
    2020-11-19 16:49:37下载
    积分:1
  • 使用 DELPHI(C++BUILDER),存储二进制数据与文件的方法,经过测试,该方法可适用于sqlserver 和 oracle...
    使用 DELPHI(C++BUILDER),存储二进制数据与文件的方法,经过测试,该方法可适用于sqlserver 和 oracle -using Delphi (C BUILDER), binary data storage and documentation methods, after testing, the method can be applied to SQLServer and oracle
    2022-03-16 06:41:51下载
    积分:1
  • 201211251165788
    管理系统的设计与实现 ,使用的框架是Struts和Hibernate,用的技术是java ,开发平台是myeclipse ,数据库是mysql(The design and implementation of the management system is based on Struts and Hibernate. The technology used is Java, the development platform is MyEclipse, and the database is mysql.)
    2018-06-04 21:27:48下载
    积分:1
  • MySQL Notes For Professionals.pdf
    MySQL Notes For Professionals.pdf
    2020-05-24下载
    积分:1
  • 696518资源总数
  • 105665会员总数
  • 6今日下载