SQL SERVER uses REPLACE to REPLACE a value in a field in a column with another value. sqlreplace
SQL SERVER replaces a value in a field with another value.
Update table name set column name = REPLACE (column name, 'A', 'bb ')
SQL SERVER "the Data Type of parameter 1 of function replace is invalid ntext" SOLUTION
UPDATE table name SET column name = REPLACE (CAST column name AS varchar (8000), 'A', 'bb ')
How to replace a value in a column field with another value in SQL SERVER 2008 database?
Use replace. The core idea is to replace ', 1,' with ', 11,12, 13,14, 15,16 ,'. Considering that 1 may appear at the beginning or end, add a comma at the beginning and end of the original string. In this way, you can replace them all. After replacement, remove the start and end commas.
Create table v (VHCL_RANGE_CODE varchar (100); insert into v select '8, 22, 41 'Union allselect' 8, 1, 3, 21 'Union allselect' 1, 22, 'Union allselect' 3, 6, 1 '-- add this article to test the situation at the end of 1 -- add a comma before and after each, replace update v set VHCL_RANGE_CODE = replace (', '+ VHCL_RANGE_CODE + ',',', 1, ',', 11,12, 13,14, 15,16, '); -- remove the comma before and after update v set VHCL_RANGE_CODE = substring (VHCL_RANGE_CODE, 2, len (VHCL_RANGE_CODE)-2) result After replacement:
Replace a value in a field with an SQL statement.
Check that your database is accessible.
SQL server
Update a set x = REPLACE (x, 'A', 'B ');
Hypothesis:
X Original content is ababababab
After execution, it becomes bbbbbbbbbb.