{"id":6989,"date":"2026-03-18T06:06:38","date_gmt":"2026-03-18T05:06:38","guid":{"rendered":"https:\/\/expert-only.com\/?p=6989"},"modified":"2024-02-22T17:44:03","modified_gmt":"2024-02-22T16:44:03","slug":"how-to-manage-line-breaks-in-sql-server","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/","title":{"rendered":"How To Manage Line Breaks in SQL Server ?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-left\"><em>How to insert or remove SQL Server line breaks, also called carriage returns in strings, columns and variables?<\/em><\/h4>\n\n\n\n<p>Transact-SQL scripts to manage line breaks in SQL Server strings stored in columns or variables. In other words how to remove them or to insert them to streamline the data integration processes. For example, after the export of a SQL query from SSMS to an Excel document, some lines are split in two different parts. And the lines are broken. This is due to input errors in sources software including line breaks.<\/p>\n\n\n\n<p>To reproduce this issue, copy data from your SSMS query results and paste it into your favourite <a href=\"https:\/\/notepad-plus-plus.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">text editor like Notepad++<\/a>. You might see line breaks there. Same use case during the <a href=\"https:\/\/expert-only.com\/en\/ssis\/import-multiple-text-files-with-ssis\/\"><strong>integration of CSV files into SQL Server using SSIS<\/strong><\/a>, these line breaks cause errors during the package execution or inconsistent data in the target table. And depending on the size of the source files, it can be very tricky to identify all the error lines in detail. Hence, you must automate this detection with a query and replace them to ensure proper integration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">About carriage returns and line feeds in text files<\/h3>\n\n\n\n<p>In text files, the character known as a carriage return (CR) instructs the cursor to transition to the start of the next line. In other words, the <strong>CR+LF sequence serves as a marker<\/strong> signifying the conclusion of one logical line and the start of another one within a given file. And this sequence is present at the end of each logical line in a text file. This sequence is employed to differentiate between lines of text within a data file.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#1-manually-insert-line-breaks-in-a-sample-sql-server-table\" >1. Manually insert line breaks in a sample SQL Server table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#2-remove-line-breaks-using-the-replace-sql-server-function\" >2. Remove line breaks using the REPLACE SQL Server function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#3-insert-line-breaks-in-a-text-with-the-t-sql-char-function\" >3. Insert line breaks in a text with the T-SQL CHAR function<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1-manually-insert-line-breaks-in-a-sample-sql-server-table\"><\/span>1. Manually insert line breaks in a sample SQL Server table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, let&#8217;s prepare a table with some <strong>sample data that contains line breaks<\/strong>. We split here the address column into three different lines. The query below performs 4 different SQL Server operations to insert line breaks that we&#8217;ll manage in the next steps of the this tutorial. <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check if the Customers table exists and drop it if necessary.<\/li>\n\n\n\n<li>Create the Customers table.<\/li>\n\n\n\n<li>Insert one unique line of data, with multiple line breaks in the Address column.<\/li>\n\n\n\n<li> Select all the data from the table.<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- 1. If the table exists, drop it\nIF EXISTS(  \n\tSELECT 1 FROM sys.objects\n\tWHERE object_id = object_id(N'dbo.CUSTOMERS') \n\t\tAND type in (N'U') )\nBEGIN DROP TABLE [dbo].[CUSTOMERS]\nEND;\nGO\n\n-- 2. Create the CUSTOMERS table\nCREATE TABLE [dbo].[CUSTOMERS] (\n\t[CustomerID] INT IDENTITY(1,1),\n\t[FirstName] NVARCHAR(20),\n\t[LastName] NVARCHAR(20),\n\t[AddressText] NVARCHAR(100),\n\t[CountryCode] NVARCHAR(3),\n\t[CountryName] NVARCHAR(50)\n);\nGO\n\n-- 3. Insert one line of data with line breaks to illustrate the use case\nINSERT INTO dbo.CUSTOMERS ( FirstName, LastName, AddressText, CountryCode, CountryName )\nVALUES ( N'SMITH',N'John', \nN'123,\nMount Gatineau Avenue,\nOttawa',\nN'CA',N'CANADA');\nGO\n\n-- 4. Select to check the data\nSELECT *\nFROM dbo.CUSTOMERS;\nGO\n<\/pre>\n\n\n\n<p>Then, if you copy and paste the <em>AddressText<\/em> column from the SQL Server result. You notice that <strong>the address contains two line breaks<\/strong>, as in the INSERT statement.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">123,\nMount Gatineau Avenue,\nOttawa<\/pre>\n\n\n\n<p id=\"h-to-go-further-this-is-the-sql-server-replace-built-in-function-documentation\">&nbsp;To continue, we&#8217;ll use the SQL Server <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/functions\/replace-transact-sql?view=sql-server-2017\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">REPLACE<\/a> built-in function in the queries.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-remove-line-breaks-using-the-replace-sql-server-function\"><span class=\"ez-toc-section\" id=\"2-remove-line-breaks-using-the-replace-sql-server-function\"><\/span>2. Remove line breaks using the REPLACE SQL Server function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Indeed, this time, to remove the line breaks, simply use the REPLACE SQL function combined with the <em><strong>CHAR(13)<\/strong><\/em> and <em><strong>CHAR(10)<\/strong><\/em> codes. These two specific codes concatenated represent the characters of the line break. Then replace them with an empty string, a space or a comma, depending on the use case. For example to clean the Address column from line breaks, use a query like this one below.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Check the results\nSELECT\tCustomerID, FirstName, LastName, AddressText\nFROM\tdbo.CUSTOMERS;\n\n-- Using the REPLACE function to remove the line breaks\nSELECT\tCustomerID, FirstName, LastName,\n        REPLACE(AddressText,CHAR(13)+CHAR(10),' ')\nFROM dbo.CUSTOMERS;\n<\/pre>\n\n\n\n<p>This time, the copy-paste gives us this result, cleaned. It clearly <strong>displays the customer address with no more line breaks<\/strong>, now the three parts of the address are on the same line.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">123, Mount Gatineau Avenue, Ottawa<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"520\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/11\/t-sql-remove-line-breaks-1-visible-in-ssms-result-as-text.jpg\" alt=\"Insert or remove line breaks in SQL Server using the REPLACE and CHAR functions\" class=\"wp-image-17769\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/11\/t-sql-remove-line-breaks-1-visible-in-ssms-result-as-text.jpg 770w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/11\/t-sql-remove-line-breaks-1-visible-in-ssms-result-as-text-300x203.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/11\/t-sql-remove-line-breaks-1-visible-in-ssms-result-as-text-768x519.jpg 768w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><figcaption class=\"wp-element-caption\"><em>Insert or remove line breaks in SQL Server using the REPLACE and CHAR text functions<\/em><\/figcaption><\/figure><\/div>\n\n\n<p><strong>You might also like this tutorial: explaining <\/strong><a href=\"https:\/\/expert-only.com\/en\/t-sql\/split-a-string-after-a-character\/\"><strong>How to split a string after a given character with SQL Server ?<\/strong><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-insert-line-breaks-in-a-text-with-the-t-sql-char-function\"><\/span>3. Insert line breaks in a text with the T-SQL CHAR function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The other way around this time, is to add a line break to a column or any text variable in a T-SQL query. Simply add the two special characters like in the code below. Indeed, we use the same method, simply invert the arguments in the function, e.g. replace a space or a particular character by the two special characters.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CHAR(13)<\/li>\n\n\n\n<li>CHAR(10)<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Query to add a carriage return and build the full address\nSELECT\n\t[CustomerID]\n\t,[FirstName]\n\t,[LastName]\n\t,[AddressText] + CHAR(13) + CHAR(10)\n\t+[CountryCode] + CHAR(13) + CHAR(10)\n\t+[CountryName] AS [FullAdress]\nFROM dbo.CUSTOMERS;\n<\/pre>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">Expert Tip:<\/span><\/strong> To see the carriage returns, activate the <strong><em>Results to Texts<\/em><\/strong> option using the <a href=\"https:\/\/expert-only.com\/en\/ssms\/download-ssms-18\/\">SSMS<\/a> menu.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Manage carriage returns using T-SQL scripts helps for data quality<\/h3>\n\n\n\n<p>In conclusion, it is relatively easy to manage line breaks using SQL Server queries, as long as they are properly understood. They can be handled by making sure the SQL Server CHAR(10) and CHAR(13) are replaced, or inserted if need be. In general, the input controls in the applications help a lot to lower the number of invalid characters inserted in a database.<\/p>\n\n\n\n<p>Indeed, it allows to significantly lower errors when formatting data manually and transferring it between applications like SSMS and Excel for example. And moreover the data integration errors in batches. Like automatic data exchange via SSIS scheduled jobs, or during transfers between databases or using APIs.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"18iDPspus9\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-string-longer-than-8000-chars\/\">SQL Server string longer than 8000 characters<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server string longer than 8000 characters&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-string-longer-than-8000-chars\/embed\/#?secret=aGxB0Ctdr4#?secret=18iDPspus9\" data-secret=\"18iDPspus9\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Questions about line breaks in SQL Server<\/h4>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1650970685004\"><strong class=\"schema-faq-question\">What is a line break in a text file?<\/strong> <p class=\"schema-faq-answer\">A line break or return carriage is when a line is cut in two or more parts and the rest of the current line appears in the next one.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1650970700889\"><strong class=\"schema-faq-question\">What&#8217;s the best tool to edit a text file?<\/strong> <p class=\"schema-faq-answer\">One of the best software to edit a file is <strong>Notepad++<\/strong> because it allows you to edit medium large files without crashing and it recognizes many other languages like HTML, CSS, PHP, XML or SQL.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1650970722026\"><strong class=\"schema-faq-question\">What&#8217;s the difference between the special characters char(13) and char(10)?<\/strong> <p class=\"schema-faq-answer\">Both char(13) and char(10) special characters have to do with new lines in text files. Char(13) is the carriage return and Char(10) is the line feed symbol.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1650970734130\"><strong class=\"schema-faq-question\">How to remove line feed from a SQL Server column?<\/strong> <p class=\"schema-faq-answer\">To remove the carriage return or line feed directly from a SQL Server column, simply apply a replace method to remove it and replace with a space, an empty string or any other text character.<\/p> <\/div> <\/div>\n\n\n\n<h5 class=\"wp-block-heading\">More T-SQL tutorials about managing the text data type<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/expert-only.com\/en\/t-sql\/split-string-with-delimiter-in-sql-server\/\">Split SQL Server text with the XML functions<\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-string-longer-than-8000-chars\/\">Manage SQL Server text with more than 8000 characters<\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/t-sql\/split-a-string-after-a-character\/\">How to split a string after a character in T-SQL?<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>How to insert or remove SQL Server line breaks, also called carriage returns in strings, columns and variables? Transact-SQL scripts to manage line breaks in SQL Server strings stored in columns or variables. In other words how to remove <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\" title=\"How To Manage Line Breaks in SQL Server ?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10299,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-6989","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Manage Line Breaks in SQL Server ? T-SQL<\/title>\n<meta name=\"description\" content=\"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Manage Line Breaks in SQL Server ?\" \/>\n<meta property=\"og:description\" content=\"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-18T05:06:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How To Manage Line Breaks in SQL Server ?\",\"datePublished\":\"2026-03-18T05:06:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\"},\"wordCount\":987,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\"},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\",\"name\":\"How To Manage Line Breaks in SQL Server ? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg\",\"datePublished\":\"2026-03-18T05:06:38+00:00\",\"description\":\"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004\"},{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889\"},{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026\"},{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Manage Line Breaks in SQL Server ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004\",\"position\":1,\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004\",\"name\":\"What is a line break in a text file?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"A line break or return carriage is when a line is cut in two or more parts and the rest of the current line appears in the next one.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889\",\"position\":2,\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889\",\"name\":\"What's the best tool to edit a text file?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"One of the best software to edit a file is <strong>Notepad++<\/strong> because it allows you to edit medium large files without crashing and it recognizes many other languages like HTML, CSS, PHP, XML or SQL.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026\",\"position\":3,\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026\",\"name\":\"What's the difference between the special characters char(13) and char(10)?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Both char(13) and char(10) special characters have to do with new lines in text files. Char(13) is the carriage return and Char(10) is the line feed symbol.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130\",\"position\":4,\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130\",\"name\":\"How to remove line feed from a SQL Server column?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"To remove the carriage return or line feed directly from a SQL Server column, simply apply a replace method to remove it and replace with a space, an empty string or any other text character.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Manage Line Breaks in SQL Server ? T-SQL","description":"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Manage Line Breaks in SQL Server ?","og_description":"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2026-03-18T05:06:38+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How To Manage Line Breaks in SQL Server ?","datePublished":"2026-03-18T05:06:38+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/"},"wordCount":987,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US"},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/","url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/","name":"How To Manage Line Breaks in SQL Server ? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg","datePublished":"2026-03-18T05:06:38+00:00","description":"To insert SQL Server line breaks into a string or to remove carriage returns from a text, use T-SQL code with char function to manage text.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004"},{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889"},{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026"},{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/backspace-typewriter-key-B42D0B1865C_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How To Manage Line Breaks in SQL Server ?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}},{"@type":"Question","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004","position":1,"url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970685004","name":"What is a line break in a text file?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"A line break or return carriage is when a line is cut in two or more parts and the rest of the current line appears in the next one.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889","position":2,"url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970700889","name":"What's the best tool to edit a text file?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"One of the best software to edit a file is <strong>Notepad++<\/strong> because it allows you to edit medium large files without crashing and it recognizes many other languages like HTML, CSS, PHP, XML or SQL.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026","position":3,"url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970722026","name":"What's the difference between the special characters char(13) and char(10)?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Both char(13) and char(10) special characters have to do with new lines in text files. Char(13) is the carriage return and Char(10) is the line feed symbol.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130","position":4,"url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-line-breaks-in-sql-server\/#faq-question-1650970734130","name":"How to remove line feed from a SQL Server column?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"To remove the carriage return or line feed directly from a SQL Server column, simply apply a replace method to remove it and replace with a space, an empty string or any other text character.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6989","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=6989"}],"version-history":[{"count":18,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6989\/revisions"}],"predecessor-version":[{"id":29963,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6989\/revisions\/29963"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10299"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=6989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=6989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=6989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}