Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««3738394041

REPLACE Multiple Spaces with One Expand / Collapse
Author
Message
Posted Wednesday, January 23, 2013 8:01 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 27, 2013 9:58 PM
Points: 2, Visits: 5
how about this ?
select '|'+ rtrim(ltrim(replace(replace(replace(replace('   Homer               Simpson  is   kewl ','  ','_'),'__',''),'_ ',' '),'_',' ')))   +'|'

its a good thing we only have odd and even number... ;o)
Post #1410876
Posted Monday, January 28, 2013 1:37 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 2:09 PM
Points: 480, Visits: 1,605
This approach was published in a solution quite early in this discussion.
Post #1412232
Posted 2 days ago @ 1:59 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 4:58 AM
Points: 1,152, Visits: 1,457
Stumbled across this thread with a Google search. (Amazing how all paths lead 'home'.)

The elegance of the solution to this problem in SQL is amazing. Got a warm glow when I contemplated it's beauty. That quickly vanished as I smacked myself for not having figured it out on my own.


Please don't go. The drones need you. They look up to you.
Post #1455682
« Prev Topic | Next Topic »

Add to briefcase «««3738394041

Permissions Expand / Collapse