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
 Delete from field

Author  Topic 

a.ashabi
Posting Yak Master

117 Posts

Posted - 2009-07-14 : 12:25:08
Hi.I have a field that has values like this:

<div align="left">79.95x49.87x50.00mm</div> Battery Charger Caplio
<div align="left">106.50x69.00x37.00mm</div> Battery Charger XV6900
<div align="left"></div> Battery Charger Xperia X1
<div align="left">80.30x49.60x45.80mm</div> Battery Charger i7
<div align="left">100</div> Battery Charger Xperia X1
.
.
.

And I dont need the div part to be in my field.I want to delete the whole div and everything between the div tag.<div>....</div>

like these results:
Battery Charger Caplio
Battery Charger XV6900
Battery Charger Xperia X1
Battery Charger i7
Battery Charger Xperia X1
.
.
.

thanks.


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-14 : 12:53:19
[code]SELECT RIGHT(yourcol,LEN(yourcol)-(PATINDEX('%</div>%',yourcol)+7)) FROM Table[/code]
Go to Top of Page

a.ashabi
Posting Yak Master

117 Posts

Posted - 2009-07-14 : 13:12:27
thank u so much helped a lot.I've changed it to
SELECT RIGHT(product_name, LEN(product_name) - (PATINDEX('%</div>%', product_name) - 1)) AS Expr1

worked :)
Go to Top of Page
   

- Advertisement -