<p>I didn't see any similar questions asked on this topic, and I had to research this for something I'm working on right now. Thought I would post the answer for it in case anyone else had the same question.</p>

[{'answer_id': 31063, 'author': 'Mark Struzinski', 'author_id': 1284, 'author_profile': 'https://Stackoverflow.com/users/1284', 'pm_score': 9, 'selected': True, 'text': '<p>I found the answer here: <a href="http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/" rel="noreferrer">http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/</a></p>\n\n<p>You just concatenate the string and insert a <code>CHAR(13)</code> where you want your line break. </p>\n\n<p>Example:</p>\n\n<pre><code>DECLARE @text NVARCHAR(100)\nSET @text = \'This is line 1.\' + CHAR(13) + \'This is line 2.\'\nSELECT @text\n</code></pre>\n\n<p>This prints out the following:</p>\n\n<blockquote>\n  <p>This is line 1.<br>\n  This is line 2.</p>\n</blockquote>\n'}, {'answer_id': 31067, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 4, 'selected': False, 'text': '<p>Following a <a href="http://www.google.co.uk/search?hl=en&amp;safe=off&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-GB%3Aofficial&amp;hs=8ER&amp;q=linebreak+in+varchar+sql&amp;btnG=Search&amp;meta=" rel="noreferrer">Google</a>...</p>\n\n<p>Taking the code from the website:</p>\n\n<pre><code>CREATE TABLE CRLF\n    (\n        col1 VARCHAR(1000)\n    )\n\nINSERT CRLF SELECT \'The quick brown@\'\nINSERT CRLF SELECT \'fox @jumped\'\nINSERT CRLF SELECT \'@over the \'\nINSERT CRLF SELECT \'log@\'\n\nSELECT col1 FROM CRLF\n\nReturns:\n\ncol1\n-----------------\nThe quick brown@\nfox @jumped\n@over the\nlog@\n\n(4 row(s) affected)\n\n\nUPDATE CRLF\nSET col1 = REPLACE(col1, \'@\', CHAR(13))\n</code></pre>\n\n<p>Looks like it can be done by replacing a placeholder with <strong>CHAR(13)</strong></p>\n\n<p>Good question, never done it myself :)</p>\n'}, {'answer_id': 31174, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 9, 'selected': False, 'text': "<p><code>char(13)</code> is <code>CR</code>. For DOS-/Windows-style <code>CRLF</code> linebreaks, you want <code>char(13)+char(10)</code>, like:</p>\n\n<pre><code>'This is line 1.' + CHAR(13)+CHAR(10) + 'This is line 2.'\n</code></pre>\n"}, {'answer_id': 31179, 'author': 'neslekkiM', 'author_id': 3308, 'author_profile': 'https://Stackoverflow.com/users/3308', 'pm_score': 2, 'selected': False, 'text': "<p>This is always cool, because when you get exported lists from, say Oracle, then you get records spanning several lines, which in turn can be interesting for, say, cvs files, so beware.</p>\n\n<p>Anyhow, Rob's answer is good, but I would advise using something else than @, try a few more, like §§@@§§ or something, so it will have a chance for some uniqueness. (But still, remember the length of the <code>varchar</code>/<code>nvarchar</code> field you are inserting into..)</p>\n"}, {'answer_id': 549244, 'author': 'Frank V', 'author_id': 18196, 'author_profile': 'https://Stackoverflow.com/users/18196', 'pm_score': 7, 'selected': False, 'text': '<p>Another way to do this is as such:</p>\n\n<pre><code>INSERT CRLF SELECT \'fox \njumped\'\n</code></pre>\n\n<p>That is, simply inserting a line break in your query while writing it will add the like break to the database. This works in SQL server Management studio and Query Analyzer. I believe this will also work in C# if you use the @ sign on strings. </p>\n\n<pre><code>string str = @"INSERT CRLF SELECT \'fox \n    jumped\'"\n</code></pre>\n'}, {'answer_id': 2382010, 'author': 'Carl Niedner', 'author_id': 435268, 'author_profile': 'https://Stackoverflow.com/users/435268', 'pm_score': 3, 'selected': False, 'text': '<p>Here\'s a C# function that prepends a text line to an existing text blob, delimited by CRLFs, and returns a T-SQL expression suitable for <code>INSERT</code> or <code>UPDATE</code> operations.  It\'s got some of our proprietary error handling in it, but once you rip that out, it may be helpful -- I hope so.</p>\n\n<pre class="lang-cs prettyprint-override"><code>/// &lt;summary&gt;\n/// Generate a SQL string value expression suitable for INSERT/UPDATE operations that prepends\n/// the specified line to an existing block of text, assumed to have \\r\\n delimiters, and\n/// truncate at a maximum length.\n/// &lt;/summary&gt;\n/// &lt;param name="sNewLine"&gt;Single text line to be prepended to existing text&lt;/param&gt;\n/// &lt;param name="sOrigLines"&gt;Current text value; assumed to be CRLF-delimited&lt;/param&gt;\n/// &lt;param name="iMaxLen"&gt;Integer field length&lt;/param&gt;\n/// &lt;returns&gt;String: SQL string expression suitable for INSERT/UPDATE operations.  Empty on error.&lt;/returns&gt;\nprivate string PrependCommentLine(string sNewLine, String sOrigLines, int iMaxLen)\n{\n    String fn = MethodBase.GetCurrentMethod().Name;\n\n    try\n    {\n        String [] line_array = sOrigLines.Split("\\r\\n".ToCharArray());\n        List&lt;string&gt; orig_lines = new List&lt;string&gt;();\n        foreach(String orig_line in line_array) \n        { \n            if (!String.IsNullOrEmpty(orig_line))  \n            {  \n                orig_lines.Add(orig_line);    \n            }\n        } // end foreach(original line)\n\n        String final_comments = "\'" + sNewLine + "\' + CHAR(13) + CHAR(10) ";\n        int cum_length = sNewLine.Length + 2;\n        foreach(String orig_line in orig_lines)\n        {\n            String curline = orig_line;\n            if (cum_length &gt;= iMaxLen) break;                // stop appending if we\'re already over\n            if ((cum_length+orig_line.Length+2)&gt;=iMaxLen)    // If this one will push us over, truncate and warn:\n            {\n                Util.HandleAppErr(this, fn, "Truncating comments: " + orig_line);\n                curline = orig_line.Substring(0, iMaxLen - (cum_length + 3));\n            }\n            final_comments += " + \'" + curline + "\' + CHAR(13) + CHAR(10) \\r\\n";\n            cum_length += orig_line.Length + 2;\n        } // end foreach(second pass on original lines)\n\n        return(final_comments);\n\n\n    } // end main try()\n    catch(Exception exc)\n    {\n        Util.HandleExc(this,fn,exc);\n        return("");\n    }\n}\n</code></pre>\n'}, {'answer_id': 20222846, 'author': 'Bruce Allen', 'author_id': 834328, 'author_profile': 'https://Stackoverflow.com/users/834328', 'pm_score': 4, 'selected': False, 'text': '<p>I got here because I was concerned that cr-lfs that I specified in C# strings were not being shown in SQl Server Management Studio query responses.</p>\n\n<p>It turns out, they are there, but are not being displayed.</p>\n\n<p>To "see" the cr-lfs, use the print statement like:</p>\n\n<pre><code>declare @tmp varchar(500)    \nselect @tmp = msgbody from emailssentlog where id=6769;\nprint @tmp\n</code></pre>\n'}, {'answer_id': 32633945, 'author': 'AjV Jsy', 'author_id': 2078245, 'author_profile': 'https://Stackoverflow.com/users/2078245', 'pm_score': 5, 'selected': False, 'text': "<p>Run this in SSMS, it shows how line breaks in the SQL itself become part of string values that span lines :</p>\n\n<pre><code>PRINT 'Line 1\nLine 2\nLine 3'\nPRINT ''\n\nPRINT 'How long is a blank line feed?'\nPRINT LEN('\n')\nPRINT ''\n\nPRINT 'What are the ASCII values?'\nPRINT ASCII(SUBSTRING('\n',1,1))\nPRINT ASCII(SUBSTRING('\n',2,1))\n</code></pre>\n\n<p>Result :<br>\nLine 1<br>\nLine 2<br>\nLine 3  </p>\n\n<p>How long is a blank line feed?<br>\n2  </p>\n\n<p>What are the ASCII values?<br>\n13<br>\n10  </p>\n\n<p>Or if you'd rather specify your string on one line (almost!) you could employ <code>REPLACE()</code> like this (optionally use <code>CHAR(13)+CHAR(10)</code> as the replacement) :</p>\n\n<pre><code>PRINT REPLACE('Line 1`Line 2`Line 3','`','\n')\n</code></pre>\n"}, {'answer_id': 54042155, 'author': 'Ken Kin', 'author_id': 927012, 'author_profile': 'https://Stackoverflow.com/users/927012', 'pm_score': 3, 'selected': False, 'text': "<p>I'd say </p>\n\n<pre><code>concat('This is line 1.', 0xd0a, 'This is line 2.')\n</code></pre>\n\n<p>or </p>\n\n<pre><code>concat(N'This is line 1.', 0xd000a, N'This is line 2.')\n</code></pre>\n"}, {'answer_id': 59189881, 'author': 'Trubs', 'author_id': 2608920, 'author_profile': 'https://Stackoverflow.com/users/2608920', 'pm_score': 5, 'selected': False, 'text': '<p>All of these options work depending on your situation, but <strong>you may not see any of them work if you\'re using SSMS</strong>    (as mentioned in some comments SSMS hides CR/LFs)</p>\n\n<p>So rather than driving yourself round the bend, Check this setting in </p>\n\n<p><strong><code>Tools</code> <code>|</code> <code>Options</code></strong></p>\n\n<p><a href="https://i.stack.imgur.com/oFGNA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oFGNA.png" alt="which will replace the"></a> </p>\n'}, {'answer_id': 62384567, 'author': 'cjonas', 'author_id': 9391130, 'author_profile': 'https://Stackoverflow.com/users/9391130', 'pm_score': 0, 'selected': False, 'text': "<p>In some special cases you may find this useful (e.g. rendering cell-content in MS Report )\n<br>example:</p>\n\n<pre><code>select * from \n(\nvalues\n    ('use STAGING'),\n    ('go'),\n    ('EXEC sp_MSforeachtable \n@command1=''select ''''?'''' as tablename,count(1) as anzahl from  ? having count(1) = 0''')\n) as t([Copy_and_execute_this_statement])\ngo\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/31057', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1284/']