Solved

sql 2005 replace carriage return statement

Posted on 2008-10-10
3
1,027 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
Comment Utility
SELECT REPLACE(REPLACE(mm2po.sdesc, CHAR(10), ''), CHAR(13), '') AS Clean
FROM SomeTable
0
 

Author Comment

by:Steve_Lockhart
Comment Utility
Worked
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
Comment Utility
Steve_Lockhart,

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

Regards,

Patrick
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

771 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

10 Experts available now in Live!

Get 1:1 Help Now