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 2005 Forums
 Transact-SQL (2005)
 XMLquery - in sql

Author  Topic 

khusiie
Yak Posting Veteran

78 Posts

Posted - 2010-01-15 : 10:55:43
Hi friends,

i have one column - content and it gives me whole xml body..i want some part from there..one paragraph which is showing after each <FONT>

how can i pull that paragraph from whole xml body?

<html xmlns:msxsl="urn:schemas-microsoft-com:xslt"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
<base target="_blank"><style> BODY, TD { background-color:#ffffff;font-family:verdana;font-size:10pt; }</style></head><body><table cellspacing="2" cellpadding="4" width="100%" height="100%"><tr><td style="font-family:verdana;font-size:16pt;">CR: Asthma and Ultrasonic Scalers</td></tr><tr><td style="color:#666666;font-size:9pt;">7713</td></tr><tr><td style="font-size:10pt;font-weight:bold;color:#000066;border-bottom:1px solid #999999;">Summary</td></tr><tr><td><P class=MsoNormal style='MARGIN: 0in 0in 0pt'><FONT face=Arial size=3>The Lab is not aware of any data to suggest that ultra dental scalers increase the risk of complications for people with asthma  It is likely that the droplets from the aerosol generated by the scaler are larger than 5 microns in diameter, which would mean they cannot be inhaled.  However, the Lab suggests that you send your inquiry to the manufacturer.</FONT></P></td></tr><tr><td style="font-size:10pt;font-weight:bold;color:#000066;border-bottom:1px solid #999999;">Additional Comments</td></tr><tr><td><P class=MsoNormal style='MARGIN: 0in 0in 0pt'><FONT face=Arial size=3>Created by Ellen Sommer on June 26, 2007. </FONT></P></td></tr><tr height="100%"><td><br></td></tr></table></body></html>

i want to pull out the RED bold part from whole lot. how an i do that?any help would be appreciated...

thanks.

DP978
Constraint Violating Yak Guru

269 Posts

Posted - 2010-01-15 : 11:08:41
this is the column that is in your table?

If so, is "<FONT" always going to appear for the first time just before the section that you need? if Yes, you can do a patindex() to fine the location of <FONT, then look up from there where the next ">" is. Use a substring to pull out everything after the ">" up to the patindex() of "</FONT"

Thats my stab at it...

Basically you need to find a consistant start point and end poitn that will stratify your desired data, and work from there.
Go to Top of Page
   

- Advertisement -