<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Split String &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/split-string/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 19 Mar 2017 17:51:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>PostgreSQL: regexp_split_to_array to Split String using different Delimiters</title>
		<link>https://www.dbrnd.com/2017/03/postgresql-regexp_split_to_array-to-split-string-using-different-delimiters/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 25 Mar 2017 16:16:37 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[regexp_split_to_array]]></category>
		<category><![CDATA[Split String]]></category>
		<category><![CDATA[string array]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4934</guid>

					<description><![CDATA[In this post, I am providing a solution to split a string by using a different type of delimiters in PostgreSQL. Splitting a string is a very common requirement for all PostgreSQL Database Developers. I used regexp_split_to_array to split the string and store the result into a string array. You can pass any delimiters. Below [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&amp;linkname=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fpostgresql-regexp_split_to_array-to-split-string-using-different-delimiters%2F&#038;title=PostgreSQL%3A%20regexp_split_to_array%20to%20Split%20String%20using%20different%20Delimiters" data-a2a-url="https://www.dbrnd.com/2017/03/postgresql-regexp_split_to_array-to-split-string-using-different-delimiters/" data-a2a-title="PostgreSQL: regexp_split_to_array to Split String using different Delimiters"></a></p><p>In this post, I am providing a solution to split a string by using a different type of delimiters in PostgreSQL.<br />
Splitting a string is a very common requirement for all PostgreSQL Database Developers.<br />
I used regexp_split_to_array to split the string and store the result into a string array. You can pass any delimiters.</p>
<p><strong>Below are two sample example using regexp_split_to_array():</strong></p><pre class="crayon-plain-tag">SELECT 
	a[1] AS DiskInfo
	,a[2] AS DiskNumber
	,a[3] AS MessageKeyword
FROM (
    SELECT regexp_split_to_array('Postgres Disk information : disk 2 : failed', ':')
) AS dt(a)


SELECT 
	a[1] AS DiskInfo
	,a[2] AS DiskNumber
	,a[3] AS MessageKeyword
FROM (
    SELECT regexp_split_to_array('Postgres Disk information , disk 2 , failed', ',')
) AS dt(a)</pre><p>
<strong>The result:</strong></p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-4936 size-full" title="Postgre SQL Split String" src="https://www.dbrnd.com/wp-content/uploads/2017/03/PostgreSQLSplitString.png" alt="Postgre SQL Split String" width="448" height="124" srcset="https://www.dbrnd.com/wp-content/uploads/2017/03/PostgreSQLSplitString.png 448w, https://www.dbrnd.com/wp-content/uploads/2017/03/PostgreSQLSplitString-300x83.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/03/PostgreSQLSplitString-150x42.png 150w" sizes="(max-width: 448px) 100vw, 448px" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL: Function to Split String Value Using Different Delimiters and Position</title>
		<link>https://www.dbrnd.com/2016/09/mysql-function-to-split-string-value-using-different-delimiters-and-position/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 14 Sep 2016 18:50:36 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Delimiter]]></category>
		<category><![CDATA[MySQL Command]]></category>
		<category><![CDATA[MySQL Database Administrator]]></category>
		<category><![CDATA[MySQL Database Designing]]></category>
		<category><![CDATA[MySQL Database Programming]]></category>
		<category><![CDATA[MySQL Error]]></category>
		<category><![CDATA[MySQL Performance Tunning]]></category>
		<category><![CDATA[MySQL Query]]></category>
		<category><![CDATA[MySQL Tips and Tricks]]></category>
		<category><![CDATA[Split String]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1727</guid>

					<description><![CDATA[In this post, I am providing one function to split string by using different type of delimiters and position in MySQL. I have created this function because splitting a string is a very common requirement for all MySQL Database Developer. I have created this function in such a way that you guys can pass any [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&amp;linkname=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F09%2Fmysql-function-to-split-string-value-using-different-delimiters-and-position%2F&#038;title=MySQL%3A%20Function%20to%20Split%20String%20Value%20Using%20Different%20Delimiters%20and%20Position" data-a2a-url="https://www.dbrnd.com/2016/09/mysql-function-to-split-string-value-using-different-delimiters-and-position/" data-a2a-title="MySQL: Function to Split String Value Using Different Delimiters and Position"></a></p><p>In this post, I am providing one function to split string by using different type of delimiters and position in MySQL. </p>
<p>I have created this function because splitting a string is a very common requirement for all MySQL Database Developer.</p>
<blockquote><p>I have created this function in such a way that you guys can pass any type of delimiter and split your string, but you also require to pass position to get exact value.  </p></blockquote>
<p><strong><code>I have also created a similar kind of split function for SQL Server.<br />
<a href="https://www.dbrnd.com/2015/12/sql-serverfunction-to-split-string-value-using-different-delimiters/" target="_blank">You can visit this article here:</a></code></strong></p>
<p>For example, we have one column EmployeeName and it contains both Firstname and Lastname which is sperated by space. I require to create two column EmployeeFirstName and EmployeeLastName.<br />
<strong><br />
Below is a function and full demonstration of this:<br />
</strong></p>
<p><strong>First, Create a user defined function:</strong></p>
<pre class="crayon-plain-tag">CREATE FUNCTION SplitString_ByAnyDelimiter
(
  InputString TEXT,
  InputDelimiter VARCHAR(8),
  InputPosition INT
)
RETURNS TEXT
RETURN 
REPLACE(SUBSTRING(SUBSTRING_INDEX(InputString, InputDelimiter, InputPosition),
       LENGTH(SUBSTRING_INDEX(InputString, InputDelimiter, InputPosition -1)) + 1),
       InputDelimiter, '');</pre> </p>
<p><strong>Sample Executions:</strong></p>
<pre class="crayon-plain-tag">SELECT SplitString_ByAnyDelimiter('Anvesh Patel', ' ', 1) AS FirstName

/* Result: 
FirstName
-----------
Anvesh
*/

SELECT SplitString_ByAnyDelimiter('Anvesh.Patel', '.', 2) AS LastName

/* Result: 
LastName
-----------
Patel
*/

SELECT SplitString_ByAnyDelimiter('Anvesh|Patel', '|', 1) AS FirstName

/* Result: 
FirstName
-----------
Anvesh
*/</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
