简体   繁体   中英

SQL update with regular expressions

I have a rather complex issue with an SQL query and was wondering if it is possible.

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

this finds all results that have a containing [] ie [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.

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, '[',''),']','')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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