[英]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.