在SQL表中修改格式相似的单元格 [英] Modify cells with similar format in SQL table
本文介绍了在SQL表中修改格式相似的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
i需要修改sql表中的一些单元格
i有这样的单元格一个名为描述的colum:
hello
i need to modify some cells in a sql table
i had cells like this in a colum called description:
10000259 - 10000259 - CATHETER SUCTION 10 FR, WITH FINGER TIP CONTROL DISPOSABLE, STERILE
10000304 - 10000304 - CLIP, HEAMOSTATIC, MEDIUM , TITANIUM, WHITE, SINGLE USE, STERILE
i只需删除数字:
i neeed to delete only the numbers:
CATHETER SUCTION 10 FR, WITH FINGER TIP CONTROL DISPOSABLE, STERILE
CLIP, HEAMOSTATIC, MEDIUM , TITANIUM, WHITE, SINGLE USE, STERILE
i需要一个功能因为我必须在2000左右修改,我需要删除的这个单元格中的所有数字都有8位数。
有人可以帮助我这个
提前感谢
我尝试过:
i need a funtion becouse i have to modify around 2000, all the numbers in this cells i need to delete had 8 digits.
can someone help me with this
thanks in advance
What I have tried:
update table
set description = 'CATHETER SUCTION 10 FR, WITH FINGER TIP CONTROL ' where description = '10000259 - 10000259 - CATHETER SUCTION 10 FR, WITH FINGER TIP CONTROL '
推荐答案
自所有数字都是相同的长度,这样的东西应该有效:
Since all of the numbers are the same length, something like this should work:
UPDATE
Table
SET
Description = Substring(Description, 23, Len(Description) - 22)
WHERE
Description Like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] - [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] - %'
;
LIKE(Transact-SQL)| Microsoft Docs [ ^ ]
这篇关于在SQL表中修改格式相似的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文