I have an MS SQL TEXT field.
I have the horrific task of cleaning it up.. there is good information and there is intentionally stored HTML in this text field, however I need to find fairly large chunks of it from chunks of a few thousand records at a time and remove it. There will be slight variations that I’ll have to modify.. meaning links and words and html will change.
I use cf and typically handle these with some replace functions.. but these are large blocks.
I also notice on testing that somewhere along the string it just doesn’t find a match when I’m using LIKE '%%'
Sample code that I’m trying to pinpoint is something like this
<div><span style="font-family: Verdana; color: rgb(0, 0, 0); font-size: 12pt;"><span style="color: rgb(0, 0, 0);">View our HUGE selection of </span><a href="http://www.link.com/department-10532.cfm" title="widgets & more!"><span style="color: rgb(0, 0, 0);">Widgets </span></a> <span style="color: rgb(0, 0, 0);">here!</span></span></div><span style="font-family: Verdana; color: rgb(0, 0, 205); font-size: 12pt;">
<h4> <hr style="color: rgb(128, 0, 0);" />
</h4>
<h4 align="center"><span style="font-family: Arial; color: rgb(128, 0, 0); font-size: 8pt;">Shop our site for quality gloves including widgets, more widgets and yet more widgets & so much more!</span></h4>
<h4 align="center"><span style="font-family: Arial; color: rgb(128, 0, 0); font-size: 8pt;">
<h4 align="center"><span style="font-family: Verdana; color: rgb(0, 0, 205); font-size: 8pt;"><span style="font-family: Verdana; font-size: 8pt;">Order online or call our Solution Specialist Hotline at 1-800-999-9999</span></span></h4></span></h4><span style="font-family: Verdana; color: rgb(0, 0, 205); font-size: 8pt;"><span style="font-family: Arial; font-size: 8pt;">
<h4 align="center"> <hr style="color: rgb(128, 0, 0);" />
</h4><span style="font-family: Verdana; color: rgb(0, 0, 205); font-size: 12pt;"></span></span></span></span></span></div>
Besides the html being horrific, I’m at a complete loss.
doing a command just to find the code like so
where vendorID = 240 and content LIKE '%<SPAN style="FONT-FAMILY:%'
shows results. Yet if I was to build on that line it shows no records at a certain point.
I did try +chr(13)+ in places I thought there was a return. The html is done through one of those web html interfaces, so when it pulls in this text field, it does maintain the breaks and formatting below.
About the only solution I have even thought about being semi successful is to manually spot check the fields that meet this criteria, count the characters and chop off the right of the string. Problem is I have to do this for dozens of variations.
This is a very hard question to be precise and I’ve considered that. The only common denominators are:
- this does have certain text phrases that are consistent
- It does occur as the last chunk of data in the TEXT field.
Any ideas?
this will help others.
First – if it is up to you make sure you have data and content separate. it wasn’t up to me. I’m helping after the fact.
After several attempts – reading other threads I used this
In my case I was trying to find code between two hr tags – and even though they had different styles = this found it.
I believe I could have just used Replace() as well and rereplace is unneeded.
Hope this saves someone else a couple hours of surfing.