How to remove spaces in middle of string in SQL server

Posted on 2008-11-10
Medium Priority
Last Modified: 2013-11-30
I have string and I want to remove spaces in middle
for example I have a string like :- GOVT OFFICE
and I want to show as  GOVTOFFICE.
Question by:easy_life
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 22926484
REPLACE(yourfield, ' ' , '')

will remove all the spaces...

Author Closing Comment

ID: 31515320
it works great! and thanks for quick reply

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

840 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