Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用SQL Server存储过程获取文件名的扩展名_Sql_Sql Server_Stored Procedures_File Extension - Fatal编程技术网

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

如何使用SQL Server存储过程获取文件名的扩展名,sql,sql-server,stored-procedures,file-extension,Sql,Sql Server,Stored Procedures,File Extension,如何使用SQL Server存储过程获取文件名的扩展名 我想获取文件名的扩展名 例如,如果文件名为sdgfh_h670-ff.docx,则结果应为.docx您可以使用SQL Server的内置字符串函数: SELECT RIGHT('sdgfh_h670-ff.docx',CHARINDEX('.',REVERSE('sdgfh_h670-ff.docx')))

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

我想获取文件名的扩展名


例如,如果文件名为
sdgfh_h670-ff.docx
,则结果应为
.docx

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

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