How can I replace (\n) in SQL with a Line Breaks? i want to do it with a SQL query,
I want in table: catalog_product_entity_text
replace the value with Line Breaks instead of (\n)
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow can I replace (\n) in SQL with a Line Breaks? i want to do it with a SQL query,
I want in table: catalog_product_entity_text
replace the value with Line Breaks instead of (\n)
you also added </n>
tags and </br>
tags but not break line so you use <li>
tags same like this example:-
<li> your description write </li>
I hope this way helpful
try to this way :)
You can use following sql queries to replace \n
with <br>
.
UPDATE catalog_product_entity_text SET value = REPLACE (value, '\\n', '<br>');
A general sql query to find and replace a matching character is given below:
UPDATE tablename SET column_name = REPLACE(column_name, 'matching_string', 'replace_with');
This is what we have used. Looked up the attribute_id for the short description, removed the carriage returns \r
and replaced the new lines \n
with <br>
UPDATE catalog_product_entity_text SET value = REPLACE(REPLACE (value, '\n', '<br>') , '\r', '')
WHERE attribute_id = (
SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = "short_description" LIMIT 1 );