Solved

sql 2005 replace carriage return statement

Posted on 2008-10-10
3
1,030 Views
Last Modified: 2011-05-06
Do you happen to know how to remove a Carriage Return and or line feeds from a field when selecting for reports.

In the mm2po.sdesc field some of our users have entered the following:

FORT SHAFTER

Cancelled PO.  Processed invoice through A/P.

When trying to use this in a report it really messes things up. I would like to pull it to one line instead of having 2 CRs that puts it on different lines.

I have tried the select replace(mm2po.sdesc,ascii char(13),) but that did not seem to solve the problem.

Any ideas you have would be very apprecaiated.
0
Comment
Question by:Steve_Lockhart
  • 2
3 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22687835
SELECT REPLACE(REPLACE(mm2po.sdesc, CHAR(10), ''), CHAR(13), '') AS Clean
FROM SomeTable
0
 

Author Comment

by:Steve_Lockhart
ID: 22689202
Worked
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 22690308
Steve_Lockhart,

Glad to help.  Please don't forget to close your question :)

Regards,

Patrick
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

861 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

30 Experts available now in Live!

Get 1:1 Help Now