简体   繁体   English

使用正则表达式的SQL更新

[英]SQL update with regular expressions

I have a rather complex issue with an SQL query and was wondering if it is possible. 我有一个相当复杂的SQL查询问题,并想知道是否可能。

SELECT Orders.ShipName
FROM Orders
WHERE (((Orders.ShipName) Like "[[]*[]]"))
ORDER BY Orders.ShipName;

this finds all results that have a containing [] ie [test] 这会找到包含[]即[test]的所有结果

however i wish to remove the [] from the string and then update. 但是我希望从字符串中删除[]然后更新。 Unfortunately i am constrained to SQL only so i am not very experienced with this. 不幸的是我只限于SQL,所以我对此不是很有经验。

I haven't a clue where to start. 我不知道从哪里开始。 Can anyone give any tips help regarding this? 任何人都可以提供任何提示帮助吗?

How about just removing those characters 如何删除这些字符

update orders
set shipname = replace(replace(shipname, '[',''),']','')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM