Solved

Help Remove empty space

Posted on 2011-09-14
3
272 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

761 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