Remove spaces from SQL Server 2008 string

1149370 pts.
Tags:
SQL Server 2008
For SQL Server 2008, is there a way I can remove all of the spaces from a specific string? I already tried LTRIM but that only removes the spaces in the right / left (not the middle). Thanks!
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use the REPLACE option

Here is a link to a page with sample code

http://stackoverflow.com/questions/10432086/remove-all-spaces-from-a-string-in-sql-server

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    You could try something like this
     SET mystring = LTRIM(RTRIM(Replace(mystring, '  ' , ' ')))
    134,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: