views:

407

answers:

2

I'm attempting to insert some data from MySQL to SQL Server. I've dumped the MySQL table to a text file as SQL insert statements. I can insert it into SQL Server ok but the carriage returns are inserting as \r\n rather than as control sequences. How can I replace the \r\n strings in the MySQL insert statements so that they will end up as carriage returns in SQL Server?

+3  A: 

The only way I can think of is to replace \r\n with ' + CHAR(13) + CHAR(10) + '.

codekaizen
+1, lol, I just wrote same code =)
Rubens Farias
+1, and you are spot on. replace( variable_or_fieldname, '\r\n', CHAR(13) + CHAR(10) )
Gaby
A: 

Just replace the \r\n escape sequence with a line break. Example:

select 'This is
a multi-line
string'
Guffa