Solved

SQL Server - How to remover white spaces from a column

Posted on 2013-11-06
3
284 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS Enable Remote Errors 4 26
Increment column based of a FK 8 23
SQL2016 to ORACLE11G linked-server 6 15
awk and Pythagoras? 5 8
I have a large data set and a SSIS package. How can I load this file in multi threading?
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
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

810 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