Solved

SQL Server - How to remover white spaces from a column

Posted on 2013-11-06
3
285 Views
Last Modified: 2013-11-06
Hi Experts,
I have a column in my table where the last name and first name are separated by a comma,
e.g. Smith,  Joseph
The problem is that there are two spaces after the comma. I would like to have only one space following the comma. How can I achieve that? Thanks for your help.
0
Comment
Question by:romsom
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 39628809
REPLACE ( string_expression , string_pattern , string_replacement )

e.g.

replace(  full_name,   ',  '   ,   ', '  ) -- spread out to make it easier to read here

replace comma & two spaces with comma & one space
0
 

Author Closing Comment

by:romsom
ID: 39628820
It worked, thank you very much!
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39628851
No problem - thank you. Cheers, Paul
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question