﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss content posted by Andy Brown / Article Discussions / Article Discussions by Author  / Function to Split a Delimited String into a Table / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 01:15:52 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Function to Split a Delimited String into a Table</title><link>http://www.sqlservercentral.com/Forums/Topic401951-422-1.aspx</link><description>Hi,Thank you, I've found this function very useful.There is a little typo at the line    SET @list = LTRIM(RTRIM(@list)) + ','Instead of concatenating with default value (,), you must concatenate with passed in @delimiter argument.    SET @list = LTRIM(RTRIM(@list)) + @delimiterWithout this, if you use delimiter different than comma, it will not add last row to the resulting table.For example:select * from DStringToTable(N'one|two', N'|')returns tablevalue-----onewhich is missing value 'two'</description><pubDate>Wed, 09 Mar 2011 02:04:27 GMT</pubDate><dc:creator>g.chakhidze</dc:creator></item><item><title>RE: Function to Split a Delimited String into a Table</title><link>http://www.sqlservercentral.com/Forums/Topic401951-422-1.aspx</link><description>Hi good Sirthanks for doing the string split function. i would like to kindly ask if you have a sample code for my scenario below;Column 1 = IDColumn 2 = LastnameColumn 3 = Job Descriptionand then i will declare a variable to be used in inserting the columns mentioned abovedeclare @Value varchar(4000)set @value = 'IDValue,Lastnamevalue,JobDescriptionvalue'i noticed that you are inserting these values in a single column. is it possible to save these values in a seperate column named ID,Lastname and Job Description? your assistance is very much appreciated.Best RegardsN.O.E.L.</description><pubDate>Wed, 13 Feb 2008 23:59:11 GMT</pubDate><dc:creator>Stylez</dc:creator></item><item><title>RE: Function to Split a Delimited String into a Table</title><link>http://www.sqlservercentral.com/Forums/Topic401951-422-1.aspx</link><description>SQL 2005 variant that doesn't use a loop.&lt;/P&gt;&lt;P&gt;&lt;A href="http://philcart.blogspot.com/2007/06/split-function.html"&gt;http://philcart.blogspot.com/2007/06/split-function.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Could be easily modified to work with nvarchar(4000)</description><pubDate>Mon, 24 Sep 2007 06:10:00 GMT</pubDate><dc:creator>philcart</dc:creator></item><item><title>Function to Split a Delimited String into a Table</title><link>http://www.sqlservercentral.com/Forums/Topic401951-422-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Miscellaneous/31913/"&gt;Function to Split a Delimited String into a Table&lt;/A&gt;[/B]</description><pubDate>Mon, 24 Sep 2007 05:10:36 GMT</pubDate><dc:creator>Andy B.</dc:creator></item></channel></rss>