Insert carriage return into sql server table

I need to insert text value into sql server table which contains line feed (carriage return)
What data type is used for this?
And what character is used for line feed?

Experts Please help

Thanks
RK
rk75Asked:
Who is Participating?
 
Frosty555Connect With a Mentor Commented:
VARCHAR and TEXT both support carriage return/line feeds.

A carriage return is CHAR(13)
A linefeed is CHAR(10)

So in SQL you can specify a crlf in your stored proc or query like this:

print 'abc' + char(13)+char(10) + 'def'
0
 
Frosty555Commented:
It is noteworthy to mention that line breaks are different in different operating systems.

In windows and dos, a line break is a CRLF, e.g. a carriage return followed by a linefeed.
       char(13)+char(10)

In unix/linux/freebsd, a line break is ONLY a line feed.
      char(10)

On Macs, a line break is ONLY a carriage return
      char(13)
0
 
Frosty555Commented:
Oh Mac OS X actually uses a linefeed only, just like unix/linux.
Apple and Mac up to OS 9 uses carriage return.

http://en.wikipedia.org/wiki/Newline#Representations
0
 
Vee_ModCommented:
Force accepted.
Vee_Mod
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.