Re: Remove Carriage Return

From: Mike Hodgson (mike.hodgson_at_mallesons.nospam.com)
Date: 02/22/05


Date: Tue, 22 Feb 2005 17:59:41 +1100

Have you tried

    replace(t1.address, char(13)+char(10), char(32))

as Mark suggested? It works for me (see example below).

declare @tmp varchar(100)
set @tmp = 'line1
line2
line3
line4
line5'

select @tmp
select replace(@tmp, char(13)+char(10), char(32))

--
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@mallesons.nospam.com |* W* http://www.mallesons.com
Peter wrote:
>Does it mean that I have to run like this
>
>replace(replace(t1.address, char(13), char(32)), char(10), 
>char(32)) ?
>
>Thanks
>
>  
>
>>-----Original Message-----
>>try removing the line feed character as well - char(10)
>>
>>
>>
>>regards,
>>Mark Baekdal
>>http://www.dbghost.com
>>http://www.innovartis.co.uk
>>+44 (0)208 241 1762
>>Database change management for SQL Server
>>
>>
>>
>>"Peter" wrote:
>>
>>    
>>
>>>I attempt to replace the Carriage Return with Space.  
>>>      
>>>
>In 
>  
>
>>>this way, in the SQL Statement, I add this script:
>>>
>>>replace(t1.address, char(13), char(32))
>>>
>>>However, it seems that it only remove the first 
>>>      
>>>
>carriage 
>  
>
>>>return but not all.  Is there any suggestion ?
>>>
>>>Thanks
>>>
>>>      
>>>
>>.
>>
>>    
>>


Relevant Pages

  • RE: Remove Carriage Return
    ... >Database change management for SQL Server ... >> I attempt to replace the Carriage Return with Space. ... Is there any suggestion? ...
    (microsoft.public.sqlserver.server)
  • Re: Remove the last carriage return and line feed from sql text field
    ... strip off the last carriage return and line feed from a text field. ... This causes havoc when we sync between our ERP system and CRM ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: changing sql server account using sem ...
    ... using the services msc is an alternative as long as ... > Database change management for SQL Server ... >> sql enterprise manager what is the syntax for a domain account that should ...
    (microsoft.public.sqlserver.server)
  • Re: Select Formatted Text From Table
    ... text (with carriage returns, tabs, and spaces). ... If you are using SQL Server Management Studio, then you can see the data ... "Query" menu. ...
    (microsoft.public.sqlserver.mseq)
  • RE: Query last modified stored procedures
    ... you could keep a history of object versions. ... >> Database change management for SQL Server ...
    (microsoft.public.sqlserver.programming)