I want a query in SQL that change all 'a' in string to 'b' in first_name column in name table. Here is my columns name: first_name | list_name
SQL Server REPLACE() Function The REPLACE() function replaces all occurrences of a substring within a string, with a new substring. Note: The search is case-insensitive.
SELECT REPLACE(REPLACE(REPLACE(REPLACE('3*[4+5]/{6-8}', '[', '('), ']', ')'), '{', '('), '}', ')'); We can see that the REPLACE function is nested and it is called multiple times to replace the corresponding string as per the defined positional values within the SQL REPLACE function.
use REPLACE()
UPDATE tableName
SET first_name = REPLACE(first_name, 'a', 'b')
but remember that REPLACE()
is case sensitive.
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