Solved

how do I remove whitespace from in between text

Posted on 2013-11-01
4
264 Views
Last Modified: 2013-11-07
I have text in a field that looks like the following:

Contract_no
-----------------
AB-123C-4567
DE-892F-
6007
GH-292I-J2006
KL-3434-
M2008

That is actually 4 rows of data. The data was entered for some of the records with what looks like a hard return. When I try to use BCP to export the records and remove the whitespace it doesn't work. How should I fix this?

I tried the following select statement in my export select RTRIM(LTRIM(contract_no)) from contracts
0
Comment
Question by:sikyala
  • 2
4 Comments
 
LVL 13

Expert Comment

by:duncanb7
Comment Utility
where you view the information ?

 Contract_no
-----------------
AB-123C-4567
DE-892F-
6007
GH-292I-J2006
KL-3434-
M2008

You view the data in webpage or in mysql database in phpmyadmin ?

If you view it in html page, you need to
set p tag with CSS

<style>
p
{
white-space:nowrap;
}
</style>

take a look for minus-sign in html page
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_28230776.html
0
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 500 total points
Comment Utility
You can try stripping them out of the data using REPLACE.  CHAR(10) and CHAR(13) are newline and carriage return characters.

SELECT REPLACE(REPLACE(myColumn, CHAR(13), ''), CHAR(10), '')
0
 

Author Comment

by:sikyala
Comment Utility
I mannually entered the sample data I am viewing it inside of sql server I open the table and look at the field values. Then I export it using bcp the data appears in the text file the same way. I will try the replace argument
0
 

Author Closing Comment

by:sikyala
Comment Utility
thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

763 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

13 Experts available now in Live!

Get 1:1 Help Now