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

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

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

  • 使用scott/tiger用户下的emp表完成下列练习,查询,删除增改
    使用scott/tiger用户下的emp表完成下列练习,查询,删除增改-Using the scott/tiger user under the emp table to complete the following exercises, query, delete the additions and changes to
    2023-08-16 10:35:03下载
    积分:1
  • beginning-sql-server-2008
    beginning sql server 2008 programming
    2013-04-14 16:28:09下载
    积分:1
  • SQL使用技术说明的书,很好用,第二版
    SQL使用技术说明的书,很好用,第二版 -SQL using the technical description of the book, very good, and the second edition of
    2022-08-10 09:15:05下载
    积分:1
  • PBwork
    仓库信息管理系统,包含简单的进销存操作,对仓库的一般信息进行管理维护。直接在PB环境中打开工程文件同时将压缩包中的MDF,LDF文件导入MSSQL中即可运行。(Warehouse information management system, including a simple Invoicing operation, the warehouse management and maintenance of general information. )
    2010-03-11 00:17:51下载
    积分:1
  • Trabalho_BD
    Aplicaç ã o MySQL estúdio musical
    2014-11-20 01:25:05下载
    积分:1
  • 这个是进销存系统・建议公司决策层同意开发该公司管理信息系统,并以此系统的研发过程作为本人毕业论文的论题。...
    这个是进销存系统・建议公司决策层同意开发该公司管理信息系统,并以此系统的研发过程作为本人毕业论文的论题。 -Invoicing System This is a decision-making suggested that the company agreed to develop the company
    2023-02-14 18:45:04下载
    积分:1
  • RecieveMessage1
    通过EXCEL VBA提取和插入SQL记录(through Excel VBA SQL insert and extract records)
    2007-05-23 10:54:48下载
    积分:1
  • 网上订餐系统
    一款很好的网上订餐系统,实现了简单的网上订餐系统的基本功能,可以为毕业设计的广大毕业生提供一个很好地模板作用,本系统采用SQL server 和JSP 来完成,结构清晰,语句也不复杂,很适合只有初学基本知识的毕业生,应急之用。
    2022-03-19 14:35:34下载
    积分:1
  • Spring-Security-Demo
    Spring Security 的演示Demo,通过mysql数据库配置用户、角色、资源等,利用mybatis实现持久化。数据库脚本在项目/WebRoot/sql 目录下(Spring Security Demo Demo, configure users, roles, and resources through the mysql database using mybatis for persistence. Database scripts in the project/WebRoot/sql directory)
    2013-12-25 10:04:39下载
    积分:1
  • asp.net
    很实用的简单的asp.net开发技术,大家可以相互体验。(Practical simple asp.net development technology, people can experience each other.)
    2015-01-07 11:10:26下载
    积分:1
  • 696516资源总数
  • 106783会员总数
  • 25今日下载