Solved

sql 2005 replace carriage return statement

Posted on 2008-10-10
3
1,032 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
query execution hang 5 31
T-SQL: "HAVING CASE" Clause 1 26
convert null in sql server 12 34
Passing Parameter to Stored Procedure 4 24
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

810 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