Liam Sorsby
Liam Sorsby

Reputation: 2982

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 [] i.e. [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?

Upvotes: 1

Views: 4287

Answers (1)

juergen d
juergen d

Reputation: 204756

How about just removing those characters

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

Upvotes: 4

Related Questions