简体   繁体   English

如何使用SQL Server存储过程获取文件名的扩展名

[英]How to get the extension of a file name using a SQL Server stored procedure

How do I get the extension of a file name using a SQL Server stored procedure? 如何使用SQL Server存储过程获取文件名的扩展名?

I want to get the extension of the file name 我想获取文件名的扩展名

For example, if the file name is sdgfh_h670-ff.docx , the result should be .docx . 例如,如果文件名为sdgfh_h670-ff.docx ,则结果应为.docx

您可以使用SQL Server的内置字符串函数:

SELECT RIGHT('sdgfh_h670-ff.docx',CHARINDEX('.',REVERSE('sdgfh_h670-ff.docx')))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL Server:如何在存储过程中获取数据库名称作为参数 - SQL Server: how to get a database name as a parameter in a stored procedure "如何使用 pyodbc 获取 SQL Server 存储过程返回值?" - How to get a SQL Server stored procedure return value using pyodbc? 如何在SQL Server 2008中使用此存储过程获得更快的结果? - How to get faster result by using this Stored Procedure in SQL server 2008? 如何使用SQL Server 2008查找基于表名搜索的存储过程的名称? - How to find the name of stored procedure, based on table name search, using SQL Server 2008? 存储过程对于用户表,使用 sql server 2014 获取年龄和姓名 - Stored Procedure For a User table, to get age and name using sql server 2014 如何在SQL Server存储过程中使用变量作为服务器名称 - How to use variable for server name in SQL Server stored procedure 获取存储在SQL Server中的文件名 - Get File Name Stored in SQL Server 使用 SQL Server 存储过程将列名与变量匹配 - Using SQL Server stored procedure to match column name to variable 使用SQL Server中的存储过程检查数据库中是否存在用户名 - Checking if user name exists in database using a stored procedure in SQL Server 在 SQL Server 2012 中,如何从视图、函数或存储过程中获取列名和数据类型? - In SQL Server 2012, how do I get the column name and data type from a view, function, or stored procedure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM