<?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>single quote &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/single-quote/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>Fri, 11 Aug 2017 20:02:27 +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>SQL Server 2016: Use STRING_ESCAPE to escape single quotes, double quotes, forward slashes</title>
		<link>https://www.dbrnd.com/2017/08/sql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 21 Aug 2017 16:16:23 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[double quote]]></category>
		<category><![CDATA[forward slashes]]></category>
		<category><![CDATA[single quote]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[STRING_ESCAPE]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5914</guid>

					<description><![CDATA[SQL Server 2016 introduced STRING_ESCAPE() to escape the characters like single quotes, double quotes, forward slashes. SQL Server 2016: Introduced JSON support, to store and retrieve JSON document Please check the below examples: Example without STRING_ESCAPE: Check the below example where I added single quotes, double quotes, forward slashes in the JSON string which is [&#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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&amp;linkname=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" 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%2F08%2Fsql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes%2F&#038;title=SQL%20Server%202016%3A%20Use%20STRING_ESCAPE%20to%20escape%20single%20quotes%2C%20double%20quotes%2C%20forward%20slashes" data-a2a-url="https://www.dbrnd.com/2017/08/sql-server-2016-use-string_escape-to-escape-single-quotes-double-quotes-forward-slashes/" data-a2a-title="SQL Server 2016: Use STRING_ESCAPE to escape single quotes, double quotes, forward slashes"></a></p><p>SQL Server 2016 introduced STRING_ESCAPE() to escape the characters like single quotes, double quotes, forward slashes.</p>
<blockquote class="wp-embedded-content" data-secret="7fgJ9NSy1G"><p><a href="https://www.dbrnd.com/2016/12/sql-server-2016-introduced-json-support-to-store-and-retrieve-json-document-isjson-json_value-json_query/">SQL Server 2016: Introduced JSON support, to store and retrieve JSON document</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/12/sql-server-2016-introduced-json-support-to-store-and-retrieve-json-document-isjson-json_value-json_query/embed/#?secret=7fgJ9NSy1G" data-secret="7fgJ9NSy1G" width="600" height="338" title="&#8220;SQL Server 2016: Introduced JSON support, to store and retrieve JSON document&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Please check the below examples:</strong></p>
<p><strong>Example without STRING_ESCAPE:</strong><br />
Check the below example where I added single quotes, double quotes, forward slashes in the JSON string which is incorrect and IsJSON is also false.</p>
<pre class="crayon-plain-tag">DECLARE @str VARCHAR(800) = 'Anvesh''s blog is "dbrnd.com" which is running from 2015/05/01'
DECLARE @json VARCHAR(800) = '[{"Name":"Anvesh","Gender":"Male","About":"'+@str+'"}]'

SELECT @json as Json</pre> </p>
<p> <strong>Result:</strong></p><pre class="crayon-plain-tag">Json
-------------------------------------------------------------------------------------------------------------
[{"Name":"Anvesh","Gender":"Male","About":"Anvesh's blog is "dbrnd.com" which is running from 2015/05/01"}]</pre><p> </p>
<p><strong> Check IsJSON:</strong></p><pre class="crayon-plain-tag">SELECT ISJSON(@json) IsJson</pre><p> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">IsJson
-----------
0</pre> </p>
<p><strong>Example with STRING_ESCAPE:</strong><br />
In the below example, check the result of STRING_ESCAPE() and IsJSON is also true.</p>
<pre class="crayon-plain-tag">DECLARE @str VARCHAR(800) = 'Anvesh''s blog is "dbrnd.com" which is running from 2015/05/01'
DECLARE @json VARCHAR(800) = '[{"Name":"Anvesh","Gender":"Male","About":"'+STRING_ESCAPE(@str, 'JSON')+'"}]'</pre> </p>
<p><strong>Result:</strong></p><pre class="crayon-plain-tag">SELECT @json as Json
Json
-----------------------------------------------------------------------------------------------------------------
[{"Name":"Anvesh","Gender":"Male","About":"Anvesh's blog is \"dbrnd.com\" which is running from 2015\/05\/01"}]</pre><p>
<p><strong> Check IsJSON:</strong></p><pre class="crayon-plain-tag">SELECT ISJSON(@json) IsJson</pre><p> </p>
<p><strong>Result:</strong></p>
<pre class="crayon-plain-tag">IsJson
-----------
1</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: How to Insert text with single quote and apostrophe?</title>
		<link>https://www.dbrnd.com/2017/05/postgresql-how-to-insert-text-with-single-quote-and-apostrophe/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 28 May 2017 16:16:27 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[apostrophe]]></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[single quote]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5339</guid>

					<description><![CDATA[The single quote and apostrophe (s) are commonly used with any text data. To escape or ignore the single quote is a standard requirement for all database developers. In this post, I am sharing solution for PostgreSQL Database Server. PostgreSQL has two options to escape single quote. You can replace single quote to double single [&#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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" 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%2F05%2Fpostgresql-how-to-insert-text-with-single-quote-and-apostrophe%2F&#038;title=PostgreSQL%3A%20How%20to%20Insert%20text%20with%20single%20quote%20and%20apostrophe%3F" data-a2a-url="https://www.dbrnd.com/2017/05/postgresql-how-to-insert-text-with-single-quote-and-apostrophe/" data-a2a-title="PostgreSQL: How to Insert text with single quote and apostrophe?"></a></p><p>The single quote and apostrophe (s) are commonly used with any text data.<br />
To escape or ignore the single quote is a standard requirement for all database developers.</p>
<p>In this post, I am sharing solution for PostgreSQL Database Server.</p>
<blockquote><p>PostgreSQL has two options to escape single quote.<br />
You can replace single quote to double single quote like (&#8221;) and the other is you can use (E&#8217;\’) to escape single quote.</p></blockquote>
<p><strong>First, Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_SingleQuoted
(	
    ID INTEGER
    ,TextData TEXT
);</pre> </p>
<p><strong>Insert some sample data with single quote using both (”) and (\’):</strong></p>
<pre class="crayon-plain-tag">INSERT INTO tbl_SingleQuoted 
VALUES 
(1,E'Anvesh\'s dbrnd.com')
,(2,E'Database\'s Properties')
,(3,'The dbrnd Blog''s Reviews');</pre> </p>
<p><strong>To SELECT all data which has ( &#8216;s ):</strong></p>
<pre class="crayon-plain-tag">SELECT *
FROM tbl_SingleQuoted 
WHERE TextData LIKE E'%\'s%';</pre> </p>
<p><strong>The Result:</strong></p>
<pre class="crayon-plain-tag">id |         textdata
----+--------------------------
  1 | Anvesh's dbrnd.com
  2 | Database's Properties
  3 | The dbrnd Blog's Reviews</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Why we should use &#8216;$$&#8217; double dollar in PG/pgSQL Block</title>
		<link>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/</link>
					<comments>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 03 Sep 2016 07:52:39 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[$$ double dollar]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[single quote]]></category>
		<category><![CDATA[string quotation]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3575</guid>

					<description><![CDATA[Actually, The funda of $$ &#8211; double dollar is very simple, but Postgres new comers have always doubted about it. When you are writing a PL/pgSQL function, the body of the function has to pass in the form of a string literal. For example: Create a sample table: [crayon-6a93a57344c27588087966/] Create a function without $$ &#8211; [&#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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&amp;linkname=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" 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%2Fpostgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes%2F&#038;title=PostgreSQL%3A%20Why%20we%20should%20use%20%E2%80%98%24%24%E2%80%99%20double%20dollar%20in%20PG%2FpgSQL%20Block" data-a2a-url="https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/" data-a2a-title="PostgreSQL: Why we should use ‘$$’ double dollar in PG/pgSQL Block"></a></p><p>Actually, The funda of $$ &#8211; double dollar is very simple, but Postgres new comers have always doubted about it. </p>
<p>When you are writing a PL/pgSQL function, the body of the function has to pass in the form of a string literal. </p>
<p><strong>For example:</strong></p>
<p><strong>Create a sample table:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_Students 
(StudID INT, StudName CHARACTER VARYING);</pre> </p>
<p><strong>Create a function without $$ &#8211; double dollar:</strong></p>
<pre class="crayon-plain-tag">CREATE OR REPLACE FUNCTION fn_TestDelimiter()
RETURNS BOOLEAN AS
'
BEGIN  
	INSERT INTO tbl_Students VALUES (1,''Anvesh'');
	RETURN TRUE; 
END;
'
LANGUAGE plpgsql</pre> </p>
<blockquote><p>We can create a function using single quote and We do not require $$ &#8211; double dollar in above example.<br />
But we should not do this, because It is not suggestible to write your function code in single quotes. </p></blockquote>
<blockquote><p>When you create your function using single quote, you have to escape all internal single quote in the body.
</p></blockquote>
<p><strong>$$ &#8211; Double Dollar:</strong> </p>
<blockquote><p>It is nothing, but just a substitute of a single quote. Using $$ &#8211; Double Dollar we can avoid all types of quoting issues.<br />
We can also put token between $$ Double Dollar like: $rnd$ which makes it unique. </p></blockquote>
<p><strong>For Example:<br />
Create a function with $$ &#8211; double dollar:</strong></p>
<pre class="crayon-plain-tag">CREATE OR REPLACE FUNCTION fn_TestDelimiter()
RETURNS BOOLEAN AS
$$
BEGIN  
	INSERT INTO tbl_Students VALUES (1,'Anvesh');
	RETURN TRUE; 
END;
$$
LANGUAGE plpgsql</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/09/postgresql-why-we-should-use-double-dollar-in-pgpgsql-block-string-literal-single-quotes/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>MySQL: How to escape apostrophe and single quote?</title>
		<link>https://www.dbrnd.com/2016/07/mysql-how-to-escape-apostrophe-and-single-quote-from-the-string/</link>
					<comments>https://www.dbrnd.com/2016/07/mysql-how-to-escape-apostrophe-and-single-quote-from-the-string/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 31 Jul 2016 20:03:03 +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[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[single quote]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2146</guid>

					<description><![CDATA[The single quote and apostrophe (s) are commonly used with any kind of text data. To escape or ignore the single quote is a common requirement for all database developers. In this post, I am sharing solution for MySQL Database Server. MySQL Server has actually two options to escape single quote. You can replace single [&#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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&amp;linkname=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" 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%2F07%2Fmysql-how-to-escape-apostrophe-and-single-quote-from-the-string%2F&#038;title=MySQL%3A%20How%20to%20escape%20apostrophe%20and%20single%20quote%3F" data-a2a-url="https://www.dbrnd.com/2016/07/mysql-how-to-escape-apostrophe-and-single-quote-from-the-string/" data-a2a-title="MySQL: How to escape apostrophe and single quote?"></a></p><p>The single quote and apostrophe (s) are commonly used with any kind of text data.</p>
<blockquote><p>To escape or ignore the single quote is a common requirement for all database developers.<br />
In this post, I am sharing solution for MySQL Database Server.</p></blockquote>
<blockquote><p>MySQL Server has actually two options to escape single quote. You can replace single quote to double single quote like (&#8221;) and the other is you can use (\&#8217;) to escape single quote.</p></blockquote>
<p><strong>First, Create a sample table:</strong></p><pre class="crayon-plain-tag">CREATE TABLE tbl_SingleQuoted
(	
    ID INTEGER
    ,TextData TEXT
);</pre><p>
<strong>Insert some sample data with single quote using both (&#8221;) and (\&#8217;):</strong></p><pre class="crayon-plain-tag">INSERT INTO tbl_SingleQuoted 
VALUES 
(1,'Anvesh\'s dbrnd.com')
,(2,'Database\'s Properties')
,(3,'The dbrnd Blog''s Reviews');</pre><p>
<strong>To SELECT all data which has ( &#8216;s ):</strong></p><pre class="crayon-plain-tag">SELECT *
FROM tbl_SingleQuoted 
WHERE TextData LIKE '%\'s%';</pre><p>
<strong>The Result:</strong></p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/03/MySQLSingleQuoted.png" rel="attachment wp-att-2149"><img decoding="async" class="alignnone wp-image-2149 size-full" title="MySQL Single Quoted" src="https://www.dbrnd.com/wp-content/uploads/2016/03/MySQLSingleQuoted.png" alt="MySQL Single Quoted" width="180" height="91" srcset="https://www.dbrnd.com/wp-content/uploads/2016/03/MySQLSingleQuoted.png 180w, https://www.dbrnd.com/wp-content/uploads/2016/03/MySQLSingleQuoted-150x76.png 150w" sizes="(max-width: 180px) 100vw, 180px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/mysql-how-to-escape-apostrophe-and-single-quote-from-the-string/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
