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 |
|
fawadafr
Starting Member
47 Posts |
Posted - 2011-02-28 : 17:08:47
|
| Hello,How can I remove extra spaces from a text string such as name or address in the database?I believe SUBSTRING function is a good way to go but wanted to hear you input on this.Thank you,--Fawad RashidiWeb Developerwww.fawadafr.com |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-02-28 : 17:18:55
|
| There's an RTRIM function that removes trailing spaces, and LTRIM removes leading spaces. The REPLACE function can remove all spaces in a string. |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-03-01 : 10:27:29
|
| and Ltrim function for leading spaces of a stringCheersMIK |
 |
|
|
fawadafr
Starting Member
47 Posts |
Posted - 2011-03-01 : 11:23:20
|
| Thank you very much for the quick reply. I believe the REPLACE() function would be best to search for every two spaces in a string and replace it with a single space. Unless, there is a better way...--Fawad RashidiWeb Developerwww.fawadafr.com |
 |
|
|
|
|
|