<?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 Table Not Found - t-sql/stored procedure in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779589#M276299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Needing some help on my issue with a query that runs fine outside of Qlikview but returns the 'Table not found' message when running in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read a lot of different posts on the discussion forums about stored procedures and the answers, when there is one, and I have not been able to get those solutions to work. I'm most likely missing something or misunderstanding something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've condensed the query for simplicity below, if my understanding is correct Qlikview is not retrieving the results.&lt;/P&gt;&lt;P&gt;I've included the top portion of the query so you can see what is going on with @Dateoffset. The query hits a MS SQL Server 2008 environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I receive 'Table not found' when I get to: &lt;STRONG style="color: #0000ff;"&gt;STORE&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; Data &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ../0_QVD_Generators/Data.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;QVD&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried updating the second to last line to look like this, EXECUTE sp_executesql @sql output&lt;BR /&gt; SELECT @sql as result; based on a post on the forums, but my results where the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help and guidance is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;BR /&gt;DECLARE @DateOffset AS INT&lt;BR /&gt;DECLARE @sql AS NVARCHAR(MAX)&lt;BR /&gt;SET @DateOffset = 0;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SET&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;@sql&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = N''&lt;BR /&gt;WHILE (@DateOffset &amp;lt; 3)&lt;BR /&gt; BEGIN&lt;BR /&gt; IF @DateOffSet &amp;gt; 0 SET @sql = CONVERT(NVARCHAR(MAX), @sql) + N' Union ';&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SET&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;@sql&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = CONVERT(NVARCHAR(MAX), @sql) +&lt;BR /&gt; N'&lt;BR /&gt; SELECT &lt;BR /&gt; Z.MARKETING_NAME,&lt;BR /&gt; Z.EFF_DATE,&lt;BR /&gt; Z.END_DATE,&lt;BR /&gt; CASE&lt;BR /&gt; WHEN Z.END_DATE &amp;gt; DATEADD(YEAR, ' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE) AND YEAR(DATEADD(YEAR, ' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE)) &amp;lt;= YEAR(GETDATE()) THEN 1&lt;BR /&gt; ELSE 0&lt;BR /&gt; END AS ACTIVE,&lt;BR /&gt; CASE&lt;BR /&gt; WHEN Z.END_DATE BETWEEN DATEADD(YEAR,' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE) AND DATEADD(YEAR, (' + CAST(@DateOffset AS NVARCHAR) + ' + 1), Z.EFF_DATE) THEN 1&lt;BR /&gt; ELSE 0&lt;BR /&gt; END AS TERMINATED&lt;BR /&gt; FROM&lt;BR /&gt; ( SUB SELECT HERE&lt;BR /&gt; )&lt;BR /&gt; LEFT JOIN HERE'&lt;BR /&gt; SET @DateOffset +=1&lt;BR /&gt; END&lt;BR /&gt;&lt;BR /&gt; EXECUTE sp_executesql @sql;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;STORE&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; Data &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ../0_QVD_Generators/Data.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;QVD&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Feb 2015 17:23:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-02-10T17:23:02Z</dc:date>
    <item>
      <title>Table Not Found - t-sql/stored procedure</title>
      <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779589#M276299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Needing some help on my issue with a query that runs fine outside of Qlikview but returns the 'Table not found' message when running in the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read a lot of different posts on the discussion forums about stored procedures and the answers, when there is one, and I have not been able to get those solutions to work. I'm most likely missing something or misunderstanding something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've condensed the query for simplicity below, if my understanding is correct Qlikview is not retrieving the results.&lt;/P&gt;&lt;P&gt;I've included the top portion of the query so you can see what is going on with @Dateoffset. The query hits a MS SQL Server 2008 environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I receive 'Table not found' when I get to: &lt;STRONG style="color: #0000ff;"&gt;STORE&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; Data &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ../0_QVD_Generators/Data.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;QVD&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried updating the second to last line to look like this, EXECUTE sp_executesql @sql output&lt;BR /&gt; SELECT @sql as result; based on a post on the forums, but my results where the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help and guidance is greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;BR /&gt;DECLARE @DateOffset AS INT&lt;BR /&gt;DECLARE @sql AS NVARCHAR(MAX)&lt;BR /&gt;SET @DateOffset = 0;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SET&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;@sql&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = N''&lt;BR /&gt;WHILE (@DateOffset &amp;lt; 3)&lt;BR /&gt; BEGIN&lt;BR /&gt; IF @DateOffSet &amp;gt; 0 SET @sql = CONVERT(NVARCHAR(MAX), @sql) + N' Union ';&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SET&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;@sql&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = CONVERT(NVARCHAR(MAX), @sql) +&lt;BR /&gt; N'&lt;BR /&gt; SELECT &lt;BR /&gt; Z.MARKETING_NAME,&lt;BR /&gt; Z.EFF_DATE,&lt;BR /&gt; Z.END_DATE,&lt;BR /&gt; CASE&lt;BR /&gt; WHEN Z.END_DATE &amp;gt; DATEADD(YEAR, ' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE) AND YEAR(DATEADD(YEAR, ' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE)) &amp;lt;= YEAR(GETDATE()) THEN 1&lt;BR /&gt; ELSE 0&lt;BR /&gt; END AS ACTIVE,&lt;BR /&gt; CASE&lt;BR /&gt; WHEN Z.END_DATE BETWEEN DATEADD(YEAR,' + CAST(@DateOffset AS NVARCHAR) + ', Z.EFF_DATE) AND DATEADD(YEAR, (' + CAST(@DateOffset AS NVARCHAR) + ' + 1), Z.EFF_DATE) THEN 1&lt;BR /&gt; ELSE 0&lt;BR /&gt; END AS TERMINATED&lt;BR /&gt; FROM&lt;BR /&gt; ( SUB SELECT HERE&lt;BR /&gt; )&lt;BR /&gt; LEFT JOIN HERE'&lt;BR /&gt; SET @DateOffset +=1&lt;BR /&gt; END&lt;BR /&gt;&lt;BR /&gt; EXECUTE sp_executesql @sql;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;STORE&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; Data &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ../0_QVD_Generators/Data.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;QVD&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 17:23:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779589#M276299</guid>
      <dc:creator />
      <dc:date>2015-02-10T17:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Table Not Found - t-sql/stored procedure</title>
      <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779590#M276300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;Since you are using sp_executesql, Use ODBC connection in QliK View script and open the conneciton in Write mode&lt;BR /&gt; ex.:ODBC CONNECT TO [DB](Mode is write)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 05:44:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779590#M276300</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-27T05:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Table Not Found - t-sql/stored procedure</title>
      <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779591#M276301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Purushotham m -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you for taking the time to look over my issue and provide feedback. I had previously enabled the option in the settings tab, however I did not add the code to the connection string. (Mode is write) fixed my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 23:11:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779591#M276301</guid>
      <dc:creator />
      <dc:date>2015-03-02T23:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Table Not Found - t-sql/stored procedure</title>
      <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779592#M276302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tim.&lt;/P&gt;&lt;P&gt;Good to hear,&amp;nbsp; it worked...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 05:35:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779592#M276302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-03T05:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Table Not Found - t-sql/stored procedure</title>
      <link>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779593#M276303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Switching to ODBC will get your around the problem, however the cause of the problem is most likely a result of the audit messages TSQL creates while executing the procedure. &lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;As SQL server Updates, Inserts, Deletes etc it gives feedback in the form of small text snippets to the calling process. e.g. when you run the proc in SSMS you will see something like this in the "messages" window:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;(30 row(s) affected)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;(0 row(s) affected)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;(0 row(s) affected)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;(0 row(s) affected)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;(36 row(s) affected)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;...&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Command(s) completed successfully.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;You will need to turn these off in order for QV to properly read the data output from the proc using OLEDB. To do this, alter the procedure by adding a "SET NOCOUNT ON" statement before your code runs anything.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 06:43:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Table-Not-Found-t-sql-stored-procedure/m-p/779593#M276303</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-29T06:43:45Z</dc:date>
    </item>
  </channel>
</rss>

