问题描述
我有一个大型数据库,我想在其中进行部分字符串搜索.用户将输入字符:JoeBloggs.
I have a large database in which I want to do a part string search. The user will enter characters: JoeBloggs.
为了争论,如果我在数据库中有一个名字Joe 23 Blo Ggs 4.我想删除 A-Z 以外的名称中的所有内容.
For arguments sake if I had a name Joe 23 Blo Ggs 4 in the database. I want to remove everything in the name other than A-Z.
我有 REPLACE(Name, ' ','') 函数来删除空格和 UPPER() 函数来将名称大写.
I have the REPLACE(Name, ' ','') function to remove spaces and the UPPER() function to capitalize the name.
是否有更有效的快速方法可以通过正则表达式来替换 A-Z 以外的任何内容.我无法更改数据库中的值.
Is there a more efficient fast way maybe by terms of regex to replace anything other than A-Z. I cannot change the values in the database.
推荐答案
第一个选项 -
您可以将 REPLACE() 函数嵌套到 32 层深.它运行得很快.
You can nest REPLACE() functions up to 32 levels deep. It runs fast.
REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE
(REPLACE (@str, '0', ''),
'1', ''),
'2', ''),
'3', ''),
'4', ''),
'5', ''),
'6', ''),
'7', ''),
'8', ''),
'9', '')
第二个选项——做相反的 -
2nd option -- do the reverse of -
从数字中移除非数字数据 + SQL
第三个选项 - 如果你想使用正则表达式
3rd option - if you want to use regex
然后http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=27205
这篇关于从字符串 sql server 中删除数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)