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
 xml ltrim rtrim

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2013-04-22 : 00:58:51

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
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-22 : 01:10:41
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

52326 Posts

Posted - 2013-04-22 : 01:13:56
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 - 2013-04-22 : 01:21:17
Thanks Chandu & Visakh

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

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-22 : 01:29:36
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

52326 Posts

Posted - 2013-04-22 : 01:36:48
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
   

- Advertisement -