I'm using MS Access and I have a table called Backup
and a column named ImageURL
. The ImageURL
column has data such as: http://domain.com/s/1234.jpg
.
I want to change the /s/
in the URL intoto /l/
by using an MS Access SQL Update and Replace.
When I'm trying it at the moment, it's replacing the entire field to /l/
.
Thanks for your help!
Rob
Update Part of a String in SQL Using the REPLACE() Function It replaces all occurrences of a specified string value with another string value. The REPLACE function returns a string where it replaces a substring with another substring.
We can remove part of the string using REPLACE() function. We can use this function if we know the exact character of the string to remove. REMOVE(): This function replaces all occurrences of a substring within a new substring.
You can use REPLACE in an UPDATE statement.
Certainly! You can use the SUBSTR operator to get a substring from a field. For example, to get bytes 3-7 of a field called MYNAME, use the expression SUBSTR(MYNAME,3,5). You can update part of a character field by concatenating the parts you want to stay intact with the new value.
Update Backup
set ImageURL =replace(ImageURL,'/s/','/I/')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With