{"id":30391,"date":"2024-03-01T06:38:00","date_gmt":"2024-03-01T05:38:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=30391"},"modified":"2024-03-04T11:20:10","modified_gmt":"2024-03-04T10:20:10","slug":"split-text-with-separator-into-lines-in-sql-server-string-split","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/","title":{"rendered":"Split Text with Separator in Lines with SQL Server STRING_SPLIT function"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"h-the-functionality-to-split-text-into-different-lines-based-on-a-separator-is-available-natively-from-sql-server-2016-and-later\">The functionality to split text into different lines based on a separator is available natively from SQL Server 2016 and later.<\/h4>\n\n\n\n<p>In order to split text with separator into lines, I have been using <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/t-sql\/functions\/string-split-transact-sql?view=sql-server-ver15\" target=\"_blank\" rel=\"noreferrer noopener\">T-SQL user-defined functions<\/a> for years before the SQL Server 2016 version came out. Indeed, starting in <strong>SQL Server 2016<\/strong> a new built-in function allows this feature. It&#8217;s the <strong>T-SQL STRING_SPLIT function<\/strong>.<\/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\/split-text-with-separator-into-lines-in-sql-server-string-split\/#1-simple-comma-separated-values-using-string-split\" >1. Simple comma-separated values using STRING_SPLIT<\/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\/split-text-with-separator-into-lines-in-sql-server-string-split\/#2-parse-text-with-semi-colon-separator-into-lines-with-sql-server\" >2. Parse text with semi-colon separator into lines with SQL Server<\/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\/split-text-with-separator-into-lines-in-sql-server-string-split\/#3-split-text-from-variable-into-multiples-rows\" >3. Split text from variable into multiples rows<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-simple-comma-separated-values-using-string-split\"><span class=\"ez-toc-section\" id=\"1-simple-comma-separated-values-using-string-split\"><\/span>1. Simple comma-separated values using STRING_SPLIT<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For this first example, a common use case for STRING_SPLIT is <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/String\/split\" target=\"_blank\" rel=\"noreferrer noopener\">to split<\/a> a string of comma-separated values (CSV) into individual rows.<\/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=\"\">SELECT value\nFROM STRING_SPLIT('Apple,Orange,Banana,Grapes,Mango', ','); \n\n-- Use the second example to rename the column\nSELECT value as Fruit\nFROM STRING_SPLIT('Apple,Orange,Banana,Grapes,Mango', ','); \n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"600\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2024\/03\/split-text-separator-in-lines-sql-server-string-split.jpg\" alt=\"Split Text with Separator into Lines with SQL Server STRING_SPLIT function\" class=\"wp-image-30422\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2024\/03\/split-text-separator-in-lines-sql-server-string-split.jpg 680w, https:\/\/expert-only.com\/wp-content\/uploads\/2024\/03\/split-text-separator-in-lines-sql-server-string-split-300x265.jpg 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><figcaption class=\"wp-element-caption\"><em>Split Text with Separator into Lines with SQL Server STRING_SPLIT function<\/em><\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-parse-text-with-semi-colon-separator-into-lines-with-sql-server\"><span class=\"ez-toc-section\" id=\"2-parse-text-with-semi-colon-separator-into-lines-with-sql-server\"><\/span>2. Parse text with semi-colon separator into lines with SQL Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Another practical application is splitting a string of emails separated by semi-colons into individual rows.<\/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=\"\">SELECT value as [Email]\nFROM STRING_SPLIT('example1@email.com;example2@email.com;example3@email.com', ';')<\/pre>\n\n\n\n<p>This will return a table where each row contains a single email address from the original string.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-split-text-from-variable-into-multiples-rows\"><\/span>3. Split text from variable into multiples rows<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>So, this third example, we use this time cities. The goal is to achieve the same result but using variables to store the string and the separator. The code is more flexible and could handle data coming from a table for example.  <\/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=\"\">-- Variables declaration\nDECLARE \n@String nvarchar(max), \n@Separator char(1);\n\n-- Initialisation of the string and the Separator\nSET @String = 'New York;Los Angeles;Chicago;Houston;Phoenix;Philadelphia;San Antonio;San Diego;Dallas;San Jose';\nSET @Separator = ';';\n\n-- Use the Split String here instead of the XML solution\nSELECT @String = STRING_SPLIT ( @String , @Separator );\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-about-the-t-sql-string-split-function\">About the T-SQL STRING_SPLIT Function<\/h3>\n\n\n\n<p>The STRING_SPLIT function in SQL Server is a powerful tool for text manipulation, enabling efficient splitting of strings based on a specified separator. Whether it&#8217;s handling CSV data or parsing complex strings, STRING_SPLIT provides a straightforward solution for converting delimited text into separate lines. Its simplicity and effectiveness make it an essential feature for developers and database administrators dealing with text processing and data transformation tasks.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"h-split-a-string-with-delimiters-into-multiple-columns\">Split a string with delimiters into multiple columns<\/h5>\n\n\n\n<p>What if you need to store each value in a separate column, for example to prepare the <a href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-data-in-csv-with-ssis\/\">import of csv files with a header<\/a> ? Here is another tutorial with an example of how to select each value from the @String variable into separate dedicated column.<\/p>\n\n\n\n<p><strong>Full tutorial on how to <a style=\"font-weight: bold;\" href=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-into-columns-sql-server\/\">Split delimited text into columns in SQL Server<\/a><\/strong><\/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=\"PAtvmBhy2M\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-into-columns-sql-server\/\">Split delimited text into columns in SQL Server<\/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;Split delimited text into columns in SQL Server&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-into-columns-sql-server\/embed\/#?secret=YUcnUWMwKc#?secret=PAtvmBhy2M\" data-secret=\"PAtvmBhy2M\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>The functionality to split text into different lines based on a separator is available natively from SQL Server 2016 and later. In order to split text with separator into lines, I have been using T-SQL user-defined functions for years <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\" title=\"Split Text with Separator in Lines with SQL Server STRING_SPLIT function\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10814,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-30391","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>Split Text with Separator in lines with SQL Server STRING_SPLIT<\/title>\n<meta name=\"description\" content=\"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.\" \/>\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\/split-text-with-separator-into-lines-in-sql-server-string-split\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Split Text with Separator in Lines with SQL Server STRING_SPLIT function\" \/>\n<meta property=\"og:description\" content=\"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\" \/>\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=\"2024-03-01T05:38:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-04T10:20:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_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=\"2 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\/split-text-with-separator-into-lines-in-sql-server-string-split\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"Split Text with Separator in Lines with SQL Server STRING_SPLIT function\",\"datePublished\":\"2024-03-01T05:38:00+00:00\",\"dateModified\":\"2024-03-04T10:20:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\"},\"wordCount\":355,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\",\"name\":\"Split Text with Separator in lines with SQL Server STRING_SPLIT\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg\",\"datePublished\":\"2024-03-01T05:38:00+00:00\",\"dateModified\":\"2024-03-04T10:20:10+00:00\",\"description\":\"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Split Text with Separator in Lines with SQL Server STRING_SPLIT function\"}]},{\"@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\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Split Text with Separator in lines with SQL Server STRING_SPLIT","description":"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.","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\/split-text-with-separator-into-lines-in-sql-server-string-split\/","og_locale":"en_US","og_type":"article","og_title":"Split Text with Separator in Lines with SQL Server STRING_SPLIT function","og_description":"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2024-03-01T05:38:00+00:00","article_modified_time":"2024-03-04T10:20:10+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_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":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"Split Text with Separator in Lines with SQL Server STRING_SPLIT function","datePublished":"2024-03-01T05:38:00+00:00","dateModified":"2024-03-04T10:20:10+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/"},"wordCount":355,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/","url":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/","name":"Split Text with Separator in lines with SQL Server STRING_SPLIT","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg","datePublished":"2024-03-01T05:38:00+00:00","dateModified":"2024-03-04T10:20:10+00:00","description":"To split text with separator into lines with SQL Server 2016 and later versions, use the STRING_SPLIT function and easily parse data in T-SQL.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/pencils-CDFB9498B85_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/split-text-with-separator-into-lines-in-sql-server-string-split\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Split Text with Separator in Lines with SQL Server STRING_SPLIT function"}]},{"@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"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/30391","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=30391"}],"version-history":[{"count":8,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/30391\/revisions"}],"predecessor-version":[{"id":30431,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/30391\/revisions\/30431"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10814"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=30391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=30391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=30391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}