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.
| Author |
Topic |
|
tissa
Starting Member
3 Posts |
Posted - 2005-02-03 : 23:59:03
|
How to remove the embedded spacesstring1 = 'abc def xyz'to output 'abcdefxyz'using a select sql I know how to remove space ( one space) or n spaces but not variable number of embedded spaces ( abc|def|||||xyz where '|' is one space )select replace( surname, ' ', '' ) from tbemployeeThanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-02-04 : 00:23:17
|
| Is this you want?select replace( surname, '|', '' ) from tbemployeeMadhivanan |
 |
|
|
tissa
Starting Member
3 Posts |
Posted - 2005-02-04 : 07:26:33
|
| Not really.....write a select statement to remove the spaces in a stringeg for the string is 'abc def klm xyz'expected result is 'abcdefklmxyz' |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-02-04 : 07:38:25
|
madhivanan is right.... try the example below:Declare @myStr varchar(100)Set @myStr = 'abc def klm xyz'Select @myStr, replace(@myStr,' ','') Corey "If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain |
 |
|
|
tissa
Starting Member
3 Posts |
Posted - 2005-02-06 : 17:21:39
|
| Thanks madhivanan Yes it is correctCorey, thanks for the sql |
 |
|
|
|
|
|