从文件名中删除扩展名 [英] Remove extensions from filename
本文介绍了从文件名中删除扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 SQL.
在表 tblDemo 中,其中一列是 'FileName'.此列的每一行都包含具有任何扩展名的不同文件名.例如.'flower.jpeg'、'batman.mov'、study.pdf 等
In a table tblDemo,one of the column is 'FileName'. Each row of this column contains a different filename with any extension. For ex. 'flower.jpeg', 'batman.mov', study.pdf etc.
请给我建议一个查询,它可以帮助我从文件名"列的每一行中删除扩展名(以及点).这样我就只能获取名称 Ex.花"、蝙蝠侠"、学习"等
Please suggest me on a query which could help me to remove the extension(and dot as well) from each row of the 'filenames' column. So that I could fetch only the name Ex. 'flower', 'batman', 'study' etc.
谢谢
推荐答案
试试这个:
UPDATE TableName
SET FileName = REVERSE(SUBSTRING(REVERSE(FileName),
CHARINDEX('.', REVERSE(FileName)) + 1, 999))
这篇关于从文件名中删除扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文