<?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: SQL query not working in OLEDB in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64649#M17393</link>
    <description>&lt;DIV class="media" style="overflow: hidden;"&gt;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1155"&gt;@HongJooChoi&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;The OLEDB VBO is the correct one to use. The functions used in the SQL query are dependent on the provider being used. In this case I assume you are using the Jet or ACE providers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17472.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17625iC0056FE78676B7E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="17472.png" alt="17472.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Given the example Excel worksheet shown above, you would have to convert your value passed from Blue Prism to a date value using a VBA function like the following:&lt;BR /&gt;&lt;BR /&gt;"SELECT * FROM [Sheet1$] WHERE [Date Created] &amp;gt;= &lt;SPAN style="color: #008000;"&gt;DATEVALUE(&lt;/SPAN&gt;'" &amp;amp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;[Data2]&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;amp; "'&lt;SPAN style="color: #008000;"&gt;)&lt;/SPAN&gt;"&lt;BR /&gt;&lt;BR /&gt;The DATEVALUE function only returns the date portion of the DateTime passed into it so you are telling the query to give you everything from midnight on, for the day specified in the &lt;SPAN style="color: #ff0000;"&gt;Data2&lt;/SPAN&gt; data item. In the example below, &lt;SPAN style="color: #ff0000;"&gt;Data2&lt;/SPAN&gt; contained a DateTime of February 20, 2022 2:13 AM.&lt;BR /&gt;
&lt;DIV class="media" style="overflow: hidden;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17473.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17628i1161D99A4424A893/image-size/large?v=v2&amp;amp;px=999" role="button" title="17473.png" alt="17473.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;While the query itself is not affected, somewhere in the conversion from DataTable to collection Blue Prism will convert DateTimes brought into collections to UTC​ so you will have to do some post manipulation if the DateTimes are relevant to your process.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Micheal Charron&lt;BR /&gt;Senior Manager&lt;BR /&gt;RBC&lt;BR /&gt;America/Toronto&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Fri, 25 Feb 2022 15:16:00 GMT</pubDate>
    <dc:creator>MichealCharron</dc:creator>
    <dc:date>2022-02-25T15:16:00Z</dc:date>
    <item>
      <title>SQL query not working in OLEDB</title>
      <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64645#M17389</link>
      <description>Hi, all.&lt;BR /&gt;&lt;BR /&gt;We're trying to use OLEDB to read data from the excel.&lt;BR /&gt;The intention is to selectively query data items based on the datetime as below.&lt;BR /&gt;&lt;BR /&gt;The current query we're using is: (but failed)&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;'select [Order ID], [Status], [Date Created], [Supplier Name] from [sheet&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;1$] where (select CONVERT([Date Created], GETDATE(), 1)) &amp;gt;='&amp;amp;[Data2]&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;// Data2 is a BP's datetime variable.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Could you correct us with the right query syntax? or Is there anything else to consider?&lt;BR /&gt;
&lt;DIV class="media" style="overflow: hidden; zoom: 1;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17475.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17626iBCA358BFF14E42A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="17475.png" alt="17475.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;HongJoo Choi&lt;BR /&gt;------------------------------&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 02:19:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64645#M17389</guid>
      <dc:creator>HongJooChoi</dc:creator>
      <dc:date>2022-02-24T02:19:00Z</dc:date>
    </item>
    <item>
      <title>RE: SQL query not working in OLEDB</title>
      <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64646#M17390</link>
      <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1155"&gt;@HongJooChoi&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;I think the main problem is with the &lt;STRONG&gt;CONVERT&lt;/STRONG&gt; function that yo are using​ in the &lt;STRONG&gt;WHERE&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Just to clarify, the &lt;STRONG&gt;CONVERT&lt;/STRONG&gt; function is another way to cast a value into a specific data type. In this case, the correct syntax for this is: &lt;EM&gt;&lt;SPAN class="sqlkeywordcolor"&gt;CONVERT&lt;/SPAN&gt;(date type, field or expression, style). &lt;/EM&gt;In your case: &lt;STRONG&gt;&lt;SPAN class="sqlkeywordcolor"&gt;CONVERT&lt;/SPAN&gt;(datetime, [Date Created], 1)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Try with this query:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;select [Order ID]&lt;BR /&gt;, [Status]&lt;BR /&gt;, [Date Created]&lt;BR /&gt;, [Supplier Name] &lt;BR /&gt;from [sheet&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;1$] &lt;BR /&gt;where &lt;SPAN class="sqlkeywordcolor"&gt;CONVERT&lt;/SPAN&gt;(datetime, [Date Created], 1) &amp;gt;="&amp;amp;[Data2]&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;You can also try with a CAST function, but you will problably have some problems with the date format.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps you!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See you in the community, bye &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Pablo Sarabia&lt;BR /&gt;Architect&lt;BR /&gt;Altamira Assets Management&lt;BR /&gt;Madrid&lt;BR /&gt;634726270&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Feb 2022 06:24:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64646#M17390</guid>
      <dc:creator>PabloSarabia</dc:creator>
      <dc:date>2022-02-24T06:24:00Z</dc:date>
    </item>
    <item>
      <title>RE: SQL query not working in OLEDB</title>
      <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64647#M17391</link>
      <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1155"&gt;@HongJooChoi&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;There are a lot of ​Transact-SQL functions that the Jet or ACE engines don't support and Convert (and Cast) is not supported. You have to look more to the VBA functions when converting data through the SQL query.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Micheal Charron&lt;BR /&gt;Senior Manager&lt;BR /&gt;RBC&lt;BR /&gt;America/Toronto&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Feb 2022 14:07:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64647#M17391</guid>
      <dc:creator>MichealCharron</dc:creator>
      <dc:date>2022-02-24T14:07:00Z</dc:date>
    </item>
    <item>
      <title>RE: SQL query not working in OLEDB</title>
      <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64648#M17392</link>
      <description>Dear Micheal&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As you pointed out, it seems the Convert and Cast are not supported by the OLEDB objects downloaded from the DX.&lt;BR /&gt;Do you mean that I need to find another way to convert the data by using such as BP's embedded functions (as shown in calculation stage) or other business objects?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;HongJoo Choi&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Feb 2022 04:11:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64648#M17392</guid>
      <dc:creator>HongJooChoi</dc:creator>
      <dc:date>2022-02-25T04:11:00Z</dc:date>
    </item>
    <item>
      <title>RE: SQL query not working in OLEDB</title>
      <link>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64649#M17393</link>
      <description>&lt;DIV class="media" style="overflow: hidden;"&gt;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1155"&gt;@HongJooChoi&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;The OLEDB VBO is the correct one to use. The functions used in the SQL query are dependent on the provider being used. In this case I assume you are using the Jet or ACE providers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17472.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17625iC0056FE78676B7E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="17472.png" alt="17472.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Given the example Excel worksheet shown above, you would have to convert your value passed from Blue Prism to a date value using a VBA function like the following:&lt;BR /&gt;&lt;BR /&gt;"SELECT * FROM [Sheet1$] WHERE [Date Created] &amp;gt;= &lt;SPAN style="color: #008000;"&gt;DATEVALUE(&lt;/SPAN&gt;'" &amp;amp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;[Data2]&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;amp; "'&lt;SPAN style="color: #008000;"&gt;)&lt;/SPAN&gt;"&lt;BR /&gt;&lt;BR /&gt;The DATEVALUE function only returns the date portion of the DateTime passed into it so you are telling the query to give you everything from midnight on, for the day specified in the &lt;SPAN style="color: #ff0000;"&gt;Data2&lt;/SPAN&gt; data item. In the example below, &lt;SPAN style="color: #ff0000;"&gt;Data2&lt;/SPAN&gt; contained a DateTime of February 20, 2022 2:13 AM.&lt;BR /&gt;
&lt;DIV class="media" style="overflow: hidden;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17473.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17628i1161D99A4424A893/image-size/large?v=v2&amp;amp;px=999" role="button" title="17473.png" alt="17473.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;While the query itself is not affected, somewhere in the conversion from DataTable to collection Blue Prism will convert DateTimes brought into collections to UTC​ so you will have to do some post manipulation if the DateTimes are relevant to your process.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Micheal Charron&lt;BR /&gt;Senior Manager&lt;BR /&gt;RBC&lt;BR /&gt;America/Toronto&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Feb 2022 15:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/SQL-query-not-working-in-OLEDB/m-p/64649#M17393</guid>
      <dc:creator>MichealCharron</dc:creator>
      <dc:date>2022-02-25T15:16:00Z</dc:date>
    </item>
  </channel>
</rss>

