<?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: SAS with DB2 update statement taking longer time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796002#M255390</link>
    <description>&lt;P&gt;Where is the&amp;nbsp;&lt;SPAN&gt;updrecords table located?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Feb 2022 07:38:35 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-02-14T07:38:35Z</dc:date>
    <item>
      <title>SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796001#M255389</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My source table is in SAS and need to update the target table in DB2 . I am using the below code .however it is taking too long to execute if the source table has many rows . any suggestions on how to improve the performance. My target table can not be dropped or rows can not be deleted&amp;nbsp; due to constraints defined . please suggest for any other options.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;proc sql;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;update&lt;/SPAN&gt;&lt;SPAN&gt; DB2.ACCOUNT&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN&gt; AREA = (&lt;/SPAN&gt;&lt;SPAN&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp;AREA &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; updrecords &lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt; Account_key = &lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;account_key"&lt;/SPAN&gt;&lt;SPAN&gt;), &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COY = (&lt;/SPAN&gt;&lt;SPAN&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp;COY &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; updrecords &lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt; Account_key = &lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;account_key"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;BRANCH = (&lt;/SPAN&gt;&lt;SPAN&gt;select&lt;/SPAN&gt;&lt;SPAN&gt; &amp;nbsp;BRANCH &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; updrecords&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt; Account_key = &lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;account_key"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if any further details required&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 07:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796001#M255389</guid>
      <dc:creator>dsadsad</dc:creator>
      <dc:date>2022-02-14T07:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796002#M255390</link>
      <description>&lt;P&gt;Where is the&amp;nbsp;&lt;SPAN&gt;updrecords table located?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 07:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796002#M255390</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-14T07:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796006#M255392</link>
      <description>&lt;P&gt;You will most likely increase performance if you place the source table in the DB and then make the update from that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several ways to do this. However, the most elegant provided by SAS/ACCESS is probably the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/p0he4t6yjfmkhpn16qrf0cdhllu6.htm" target="_self"&gt;DBMSTEMP= LIBNAME Statement Option&lt;/A&gt;. The data you put in the library (that points to the DB) will become #temp tables in the DB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a new library that points to the DB and use the option above.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Put the source table in the new library.&lt;/LI&gt;
&lt;LI&gt;Run the update entirely in the DB using the new #temp table as the source.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feel free to ask &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 07:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796006#M255392</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-14T07:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796007#M255393</link>
      <description>&lt;P&gt;This is equivalent to the Pushing Updates part of&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/n0irpkyp22l7vzn1il9lx6f4wmx9.htm" target="_self"&gt;Temporary Table Support for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xisDoc-nobr"&gt;SAS/ACCESS&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 08:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796007#M255393</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-02-14T08:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796027#M255402</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/90188"&gt;@dsadsad&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the where clause:&amp;nbsp;&lt;SPAN&gt;Account_key =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"&amp;amp;account_key" are you executing this code for a single row or do you call this code within a SAS Macro or call execute() statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If there are many accounts in your transaction table&amp;nbsp;&lt;EM&gt;updrecords&amp;nbsp;&lt;/EM&gt;for updating rows&amp;nbsp;then as others proposed first upload this table to DB2 and then code an inner join for updating the target table with a transaction table. There are many examples out there if you Google with keywords like "update a table with another table" - or similar.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 11:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796027#M255402</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-02-14T11:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS with DB2 update statement taking longer time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796152#M255446</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response and suggestion. i will try this option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does it give better performance if we use sql passthrogh for update statement ?&lt;/P&gt;&lt;P&gt;please share if you have any sample code for update statement with in DB2. i can google but just checking if there is any which works well&lt;/P&gt;&lt;P&gt;finally if you already tried this approach with in DB, how much performance improvement we are expecting .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i will be trying this option, however it just takes time to get create table access from DBA with all the process to be followed and hence asking the above questions.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 22:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-with-DB2-update-statement-taking-longer-time/m-p/796152#M255446</guid>
      <dc:creator>dsadsad</dc:creator>
      <dc:date>2022-02-14T22:11:55Z</dc:date>
    </item>
  </channel>
</rss>

