<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Get Rid of Quotes in the SQL expression in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494306#M38787</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Babak,&lt;BR /&gt;In the query, try stripping the double quotes:&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.definitionQuery =&amp;nbsp; '{0} in ({1})' .format(newName.strip('"'), queryList)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Kerry&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Mar 2013 14:21:14 GMT</pubDate>
    <dc:creator>babakkasraei</dc:creator>
    <dc:date>2013-03-15T14:21:14Z</dc:date>
    <item>
      <title>How to Get Rid of Quotes in the SQL expression</title>
      <link>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494304#M38785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have some codes in my script like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
queryList = selectedFids.replace(';', ',')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
newName = arcpy.AddFieldDelimiters(lyr, "[OBJECTID]")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
lyr.definitionQuery =&amp;nbsp; '{0} in ({1})' .format(newName, queryList)

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the second line for AddFieldDElimiters properties I have to use Quotes for [OBJECTID] to work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my SQL query I must only use [OBJECTID] without quotes, but quotes come to my query from newName. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to get rid of the quotes in the sql query. How can I do that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Babak&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2013 00:03:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494304#M38785</guid>
      <dc:creator>babakkasraei</dc:creator>
      <dc:date>2013-03-15T00:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get Rid of Quotes in the SQL expression</title>
      <link>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494305#M38786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Babak,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In the query, try stripping the double quotes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.definitionQuery =&amp;nbsp; '{0} in ({1})' .format(newName.strip('"'), queryList)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2013 14:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494305#M38786</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2013-03-15T14:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Get Rid of Quotes in the SQL expression</title>
      <link>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494306#M38787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Babak,&lt;BR /&gt;In the query, try stripping the double quotes:&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;lyr.definitionQuery =&amp;nbsp; '{0} in ({1})' .format(newName.strip('"'), queryList)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Kerry&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2013 14:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-get-rid-of-quotes-in-the-sql-expression/m-p/494306#M38787</guid>
      <dc:creator>babakkasraei</dc:creator>
      <dc:date>2013-03-15T14:21:14Z</dc:date>
    </item>
  </channel>
</rss>

