1 Reply Latest reply: Nov 21, 2017 3:48 AM by Jonathan Dienst RSS

    How to use sql #temp table and insert statement in qlik

    Ram Krishna

      Hi,

       

      Anyone have idea about sql #temp table and insert statement usability in qlik.

      I have a sql query with multiple insert and #temp table, how to use this query in qlik.

       

      Thanks,

      RK

        • Re: How to use sql #temp table and insert statement in qlik
          Jonathan Dienst

          Just use the SQL keyword. The load will return no data but that is not a problem. For example

           

          CONNECT ...

           

          // create temp table (no data returned)

          SQL

          SELECT * into #temp

          FROM mytable;

           

          // do some manipulation to the temp table (no data returned)

          SQL

          UPDATE #temp

          ...

          ...

           

          // Now get the data into QV

          Table:

          SQL SELECT * FROM #temp;

           

          DISCONNECT; //#temp out of scope after disconnect, so the resources used are released

           

          The #temp table remains in scope for the duration of a single database connection. Make sure that the connection has the necessary permissions to create temp tables.