Solved

Help Remove empty space

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Creating and Managing Databases with phpMyAdmin in cPanel.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now