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
 SQL Server Development (2000)
 String search

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-21 : 08:29:13
keshavamurthy writes "I have the following string data in the SQL Server 2000 database with html tags as shown below. I want to project only the text separated by comma and exclude all HTML tags seen below. I tried many string functions but not completely succesful. can you please help.

Simple PC Move for assets with asset tag: 04865 <li>from :T_08C16 to: T 4C16</li> <li>MAGIC Ticket No:123456</li> <li>Date Type: By 12/16/2004</li> <li>IT Coordinator Contacted: Yes</li> <li>Office of Administraton Contacted: Yes</li> <li></li>Move Services:Equipment, LAN, </li><li>Current Office:L3/EER</li> <li>Recipient Office:L3/EER</li> <li>Voice Mail:yes</li> <li>Voice Mail Number:301-415-5152</li> <li>Current Telephone: (301)415-5977</li> <li>Move Type: permanent</li> "

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-02-21 : 08:34:32
I would dump it into a temp table and use REPLACE.

Jim
Users <> Logic
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-02-21 : 08:54:54
why a temp table, jim?

declare @b varchar(500)
set @b = '04865 <li>from :T_08C16 to: T 4C16</li> <li>MAGIC Ticket No:123456</li> <li>Date Type: By 12/16/2004</li> <li>IT Coordinator Contacted: Yes</li> <li>Office of Administraton Contacted: Yes</li> <li></li>Move Services:Equipment, LAN, </li><li>Current Office:L3/EER</li> <li>Recipient Office:L3/EER</li> <li>Voice Mail:yes</li> <li>Voice Mail Number:301-415-5152</li> <li>Current Telephone: (301)415-5977</li> <li>Move Type: permanent</li>'

select replace(replace(@b, '</li>', ''), '<li>', '') as NoTags


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

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-02-21 : 10:15:17
Just incase he did not want to alter his original.
Ahhh I see you did not do an update.

Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -