Importing Data from SQL Server 2016 from Stored Procedure w #TmpTbl
I am trying to pull data with the following script in Qlik Sense 3.2:
LIB CONNECT TO 'ABCSQLServer';
SQL EXEC MyDB.dbo.usp_GetDataFromSQL;
Store temp01 into [lib://SomeQlikLocation\QVDFolder\GetDataFromSQL.QVD] (qvd);
drop table temp01;
This code works fine as long as the stored procedure pulls data without using a temp table (CTE, Table Variable). However, as soon as I include a #tempTable in the stored procedure everything fails. It appears as if the connection doesn’t have access to tempdb but it does. Does anyone know why this is happening? Your help is greatly appreciated.
Previously I had been rewriting my stored procedures with CTEs but this time was different since I used several windowing functions (row_count) and the performance boost of temp table was really needed. Thanks for your quick response and the spot on solution! I really appreciate the help.
Out of curiosity, do you know why the nocount must be turned on?