Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to replace div tags with p tags in sql

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2015-05-06 : 05:07:41
I want to replace div tags with p tags in a column in sql.

<div style: bold> abc </abc>
<div> efgh></div>

required output:
<p>abc</p>
<p>efgh</p>

Kristen
Test

22859 Posts

Posted - 2015-05-06 : 05:58:43
I doubt you can do it. The example you have would be fine, but nested tags would be hard

<div><b> efgh</b></div>

whenever I have come up against this type of problem before I've always used something that will PARSE HTML and thus safely process the tags. You need to also consider what will happen if the HTML is badly formed. For example a missing close bracket:

<div efgh></div>
Go to Top of Page
   

- Advertisement -