<?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>Question Re: How to query temporary tables and preview data during debugging in SQL Script? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaa-p/690887#M185420</link>
    <description>&lt;P&gt;You may want to check the SQLScript documentation again. DDL commands like UPDATE, INSERT, DELETE have been supported for years with table variables.&lt;/P&gt;&lt;P&gt;In most cases, you should be able to avoid using session temporary tables and use the more efficient table variables instead.&lt;/P&gt;&lt;P&gt;AFAIK there is no option to inspect the contents of session local temp tables directly. You could however try and assign them to a table variable and inspect that table variable then.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Nov 2018 00:24:05 GMT</pubDate>
    <dc:creator>lbreddemann</dc:creator>
    <dc:date>2018-11-26T00:24:05Z</dc:date>
    <item>
      <title>How to query temporary tables and preview data during debugging in SQL Script?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaq-p/690886</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;
  &lt;P&gt;I am trying to perform a similar use of monitoring internal tables as in ABAP debugger but in SQL Script procedure debugging with WebIDE in XSA.&lt;/P&gt;
  &lt;P&gt;However, I can only preview the data inside table variables, it looks not logical to create table variables for each row that I want to monitor the internal table. There can be needed to delete or update records, which is not a provided feature of table variables.&lt;/P&gt;
  &lt;P&gt;HANA doesn't allow dirty reads either, as a result, there is not an option to change the isolation level to "read uncommitted", so I can not read the data before it's committed even if I use global temporary tables instead, to query the table from another SQL console window.&lt;/P&gt;
  &lt;P&gt;I have written the procedure below to demonstrate the issue. How can I &lt;STRONG&gt;monitor/query the data&lt;/STRONG&gt; inside #PEOPLE temporary table &lt;STRONG&gt;during debugging&lt;/STRONG&gt;?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CREATE PROCEDURE
TEST_01 (out outTab TABLE 
(
employee nvarchar(10), manager nvarchar(10), manager2 nvarchar(10)) )
LANGUAGE SQLSCRIPT
AS
   vl_cnt integer = 0;
BEGIN
 select count(*) into vl_cnt from
SYS.M_TEMPORARY_TABLES where table_name like '%#PEOPLE%';
 IF :vl_cnt &amp;gt; 0
 THEN
 drop table #PEOPLE;
 END IF;
 CREATE LOCAL TEMPORARY TABLE #PEOPLE (employee
nvarchar(10), manager nvarchar(10)) ;
 insert into #PEOPLE VALUES('person01','person03');
 insert into #PEOPLE VALUES('person02','person03');
 insert into #PEOPLE VALUES('person03','person05');
 insert into #PEOPLE VALUES('person04','person02');
 delete from #PEOPLE WHERE EMPLOYEE ='person04'; 
 --breakpoint
 outTab = select t1.employee, t1.manager,
t2.manager as manager2 from #PEOPLE as t1
left join #PEOPLE as t2 on t1.manager = t2.employee;
END
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I have tried the "expressions" feature of the debug perspective, but it can't find the #PEOPLE table and returns as invalid. I guess it uses another session other than the debug session. &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/245374-capture.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Contributions are appreciated,&lt;/P&gt;
  &lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Nov 2018 14:32:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaq-p/690886</guid>
      <dc:creator>former_member192683</dc:creator>
      <dc:date>2018-11-25T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to query temporary tables and preview data during debugging in SQL Script?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaa-p/690887#M185420</link>
      <description>&lt;P&gt;You may want to check the SQLScript documentation again. DDL commands like UPDATE, INSERT, DELETE have been supported for years with table variables.&lt;/P&gt;&lt;P&gt;In most cases, you should be able to avoid using session temporary tables and use the more efficient table variables instead.&lt;/P&gt;&lt;P&gt;AFAIK there is no option to inspect the contents of session local temp tables directly. You could however try and assign them to a table variable and inspect that table variable then.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 00:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaa-p/690887#M185420</guid>
      <dc:creator>lbreddemann</dc:creator>
      <dc:date>2018-11-26T00:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to query temporary tables and preview data during debugging in SQL Script?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaa-p/690888#M185421</link>
      <description>&lt;P&gt;Thank you for providing awareness @&lt;SPAN class="mention-scrubbed"&gt;lars.breddemann&lt;/SPAN&gt;, so local temporary tables content can't be inspected during debugging. &lt;/P&gt;&lt;P&gt;I didn't know that but when there is a better solution like the ability to use DDL commands for table variables, it's really not a matter. I was trying the same syntax to insert rows to table variables, checked SQLScript documentation again, "Modifying the Content of Table
Variables" section has the explanation in there. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 13:25:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-query-temporary-tables-and-preview-data-during-debugging-in-sql/qaa-p/690888#M185421</guid>
      <dc:creator>former_member192683</dc:creator>
      <dc:date>2018-11-27T13:25:08Z</dc:date>
    </item>
  </channel>
</rss>

