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
 Get rid of some unwanted data

Author  Topic 

javahf
Starting Member

34 Posts

Posted - 2011-04-24 : 22:01:24
I have the following inquiry which was written with help of few people on this site and works well .
SELECT o.Orderid,o.OrderStatus,o.BillingLastName,o.BillingState,o.PaymentAmount,o.TotalShippingCost, o.SalesTax1 ,
STUFF((SELECT ',' + d.Productname , d.options FROM Orderdetails d WHERE o.Orderid = d.Orderid FOR XML PATH('')),1,1,'') AS
Productname
FROM Orders o
where o.OrderID > 1179

output for field productname looks like :

Marino<options>[</i>Handlebars:Riser + Oury Grips][</i>Size:55][Add Tire Set:No Extra Tire Set][Pedal Type:Standard Pedal Set][Add Hold Fast Straps:No Hold Fast Straps]</options>,$20 ILLITERATE PROMO [marino]<options></options>


i would like :
1-get rid of any word <option> ,
2-Get rod of any </i>
3-where it says ADD and answer is NO - do not show that option
4- Field.options is a memo field and d.productname is text field ( perhaps that can help you to write a sperate line)

The data should ideally look like
Marino;[Handlebars:Riser + Oury Grips][Size:55][Pedal Type:Standard Pedal Set],$20 ILLITERATE PROMO [marino]

I appreciate any help

youky
Starting Member

5 Posts

Posted - 2011-04-25 : 02:37:08
unspammed
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-25 : 04:08:49
See if this helps
http://beyondrelational.com/blogs/madhivanan/archive/2009/05/11/removing-unwanted-characters.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -