Remove empty spaces in a String in TSQL [Resolved]

Posted by Vuyiswamb under Sql Server on 10/20/2011 | Points: 10 | Views : 2025 | Status : [Member] [MVP] [Administrator] | Replies : 2
Good Day All


i have the Following string in a Field


'This
is the

reason that i did this>> '


i want to remove spaces in TSQL to this

This is the reason that i did this>> 

THanks

Thank you for posting at Dotnetfunda
[Administrator]



Responses

Posted by: Vuyiswamb on: 10/20/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down

Resolved
Thanks i used this and it worked

declare @NewLine char(2)

set @NewLine=char(13)+char(10)

select rtrim(ltrim(Replace('This
is the

reason that i did this>> ',@NewLine,'')))


Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 10/27/2011 [Member] Starter | Points: 25

Up
0
Down
string split=mytring.Replace(new char[ ] {" "})

hope this will help

Regards
Sriram.R

sriram

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response