Solved

Help Remove empty space

Posted on 2011-09-14
3
274 Views
Last Modified: 2012-05-12
Hi,

Is there a way to remove any empty space in my ChurchTbl.ChurchName field.

My javascript is not working correct because of empty spaces at the end of the churchName.

some record don't have any empty spaces and some do have.  

I need to check for an empty spaces and remove it .


Thanks,


SELECT CityTbl.CityID, ChurchTbl.ChurchID, ChurchTbl.ChurchName
FROM StateTbl 
LEFT JOIN CityTbl ON CityTbl.StateID = StateTbl.StateID
LEFT JOIN ChurchTbl ON ChurchTbl.ChCityID = CityTbl.CityID
WHERE ChurchTbl.ChurchName <> "null" and ChurchTbl.ChurchStatus = 1
and CityTbl.CityStatus = 1 and StateTbl.StateStatus = 1
and ChurchTbl.ChurchID >=  13773 
order by ChurchTbl.ChurchName ASC

Open in new window

0
Comment
Question by:lulu50
[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 18

Accepted Solution

by:
Cluskitt earned 500 total points
ID: 36536664
You can use the TRIM() function. You can even update the table itself so you don't have to worry about it:
UPDATE ChurchTbl Set ChurchName=TRIM(ChurchName) WHERE LEFT(ChurchName,1)=' ' OR RIGHT(ChurchName,1)=' '
0
 

Author Closing Comment

by:lulu50
ID: 36536809
thanks
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 36536927
Glad to help
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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