SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 xml ltrim rtrim
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shanmugaraj
Posting Yak Master

219 Posts

Posted - 04/22/2013 :  00:58:51  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote

In the below query, i need data with ltrim where
'Name, Location, Gender' is passed as parameter.
I want them to be passed as 'Name,Location,Gender'


SELECT CONVERT(xml,'<root><s>' + (REPLACE('Name, Location, Gender' ,',','</s><s>') + '</s></root>'))



THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 04/22/2013 :  01:10:41  Show Profile  Reply with Quote
REPLACE('Name, Location, Gender', ', ', '</s><s>') -- here give one space after comma

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 04/22/2013 :  01:13:56  Show Profile  Reply with Quote
you need to strip space right?

REPLACE('Name, Location, Gender', ', ', ',')


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 04/22/2013 :  01:21:17  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
Thanks Chandu & Visakh

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 04/22/2013 :  01:29:36  Show Profile  Reply with Quote
quote:
Originally posted by shanmugaraj

Thanks Chandu & Visakh

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com


Welcome

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 04/22/2013 :  01:36:48  Show Profile  Reply with Quote
quote:
Originally posted by shanmugaraj

Thanks Chandu & Visakh

THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com


what was your intended result?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000