Search results
1 lut 2010 · Here's a query to update a table based on a comparison of another table. If record is not found in tableB, it will update the "active" value to "n". If it's found, will set the value to NULL. UPDATE tableA LEFT JOIN tableB ON tableA.id = tableB.id SET active = IF(tableB.id IS NULL, 'n', NULL)"; Hope this helps someone else.
20 cze 2023 · To update a column with a substring from another column in MySQL, you can utilize the UPDATE statement with the SUBSTRING function. By specifying the source column, the starting position, and the length, you can extract the desired substring and update the target column accordingly.
8 lip 2024 · I have longtext (DC2Type:array) column and incorrect some characters values in a column string, so i want to replace this data format: a:2:{s:7:"content";s:6:"text 1";s:3:"url";s:19:"https://someurl.com";}
The function REGEXP_REPLACE() returns the result string where occurrences of the matches are replaced with the new substring. If string, pattern, or replacement is NULL, the function REGEXP_REPLACE() will return NULL. MySQL REGEXP_REPLACE function examples. Let’s take some examples of using the REGEXP_REPLACE() function.
26 sty 2024 · MySQL uses certain characters for specific functions within queries. Characters such as single quotes ('), double quotes ("), backslashes (\), and NULL are considered special because they serve as string delimiters, escape characters, or represent absence of data, respectively.
22 wrz 2023 · Here’s an example query using our REPLACE() function: UPDATE table_name SET column_name = REPLACE(column_name, 'current_text', 'new_text') WHERE some_column=some_value; In this case, 'current_text' would be replaced by 'new_text' in your chosen column from table_name .
28 cze 2013 · You don't need wildcards in the REPLACE - it just finds the string you enter for the second argument, so the following should work: UPDATE dbo.xxx. SET Value = REPLACE(Value, '123', '') WHERE ID <=4. If the column to replace is type text or ntext you need to cast it to nvarchar. UPDATE dbo.xxx.