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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 search data from crappy text field

Author  Topic 

dupati1
Posting Yak Master

123 Posts

Posted - 2005-10-03 : 16:33:05
i have a text field in my table...this text field is populated by the software that we use in...and it looks in the following format...



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en">
<!-- This document was converted from RTF source: By r2net 5.7.7 DLL V5.1.1 Translation:html.trn
$Revision: 1.64 $ $Revision: 1.47 $ See http://www.logictran.com Filename:
OutFileName:-.html Application Directory:C:\Program Files\Deltek\Vision\Conversions
Subject: Author: Operator: Document
Comments: Version Comments:
Comments: Keywords: Translation Date:05/01/2004 Translation Time:11:51:11
Translation Platform:Win32
Number of Output files:1 This File:-.html
SplitDepth=0 SkipNavPanel=1 SkipLeadingToc=1 SkipTrailingToc=1 GenContents=0
GenFrames=0 GenIndex=0 -->
<head><meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"> <title>.html</title> </head>
<body > <div>Engineering<br>
Geotechnical<br>Civil/Municipal
<br>Surveying<br>
Transportation<br>
Environmental<br>
Water Resources<br><
/div> </body> </html>


i am only interested in the red parts of the text...those are the terms that users search on...if they search on lets say...Surveying...this record should show up in the result set...

how can going about handling this situation...please suggest...

my inital thoughts...

thought writing a function that cleans up the data creates a temp table by just grabbing the required search terms...but not sure how to start creating this function...may be i need to use patindex...

thank you

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-10-03 : 17:23:18
you could use like...
where textCol like '%surveying%'

Go with the flow & have fun! Else fight the flow
Go to Top of Page

dupati1
Posting Yak Master

123 Posts

Posted - 2005-10-03 : 17:34:42
thanks for the reply...but i dont think something that simple is going to working in my case...may be i also have a requirement of editing/updating this particular field later and i will just hit a block with using LIKE

thanks

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-03 : 23:53:00
Can you reliably extract the <DIV> ... </DIV> bit [i.e. it is distinctive and will not be confused with other DIVs in the text] and then "split" it on the "<BR>"s into separate rows?

(plenty of "SPLIT" functions/threads to be found here on SQL Team - if you are stuck there's a link in the "Frequently Given Answers" thread at the top of the "New to SQL" forum)

Kristen
Go to Top of Page
   

- Advertisement -