Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 strange characters

Author  Topic 

bpsintl
Posting Yak Master

132 Posts

Posted - 2008-12-17 : 07:03:47
I have a database that I've converted from MySQL to MS SQL. Everything is fine except for one thing.

A few of the fields in the database store the carriage return character when the user presses return on their keyboard. In an MS SQL database this character just looks like a space in the actual database field contents but its obviously some character.

When I converted the db, all those characters converted over as "\r\n" which breaks my application.

Any idea how I can replace these "\r\n" characters with the native MS SQL character for a carriage return?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 07:06:32
use REPLACE() function
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2008-12-17 : 07:16:41
I know that, but what is the character I need to replace the \r\n with?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 07:18:08
quote:
Originally posted by bpsintl

I know that, but what is the character I need to replace the \r\n with?


CHAR(13) is equivalent of carriage return in T-sql
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 07:19:17
and CHAR(13) + CHAR(10) will be equivalent of \r\n
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2008-12-17 : 07:35:47
Excellent, that's great! Thanks for that
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 07:46:09
welcome
Go to Top of Page
   

- Advertisement -