We can do this in two cascaded steps: 1. Replace all occurrences of Char(10) with Char(13)+Char(10) 2. Replace all occurrences of Char(13)+Char(13)+Char(10) with Char(13)+Char(10) Note that Step 1 replaces some unwanted occurrences also (i.e. Char(13)+Char(10) occurrences), but the second step fixes those unwanted wrong replaces. Have fun with this piece of code:
declare @myTestString varchar(50)
set @myTestString = char(10)+char(13)+char(10)+char(10)+char(13)+char(13)+char(13)+char(10)
set @myTestString = replace( @myTestString, char(10), char(13)+char(10) )
set @myTestString = replace( @myTestString, char(13)+char(13)+char(10), char(13)+char(10) )
Cheers, Syed Mehroz Alam
My Blog My Articles