Solved

SQL Server - How to remover white spaces from a column

Posted on 2013-11-06
3
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

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 49

Expert Comment

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

Featured Post

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

695 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