Solved

SQL Server - How to remover white spaces from a column

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Building JSON Results Table FROM DB 9 37
SQL Syntax 6 32
SQL Distinct Question 3 15
Access 2010 Only Including Numbers After Certain Limit 3 7
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
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…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

733 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