Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Generally Qlikview is great at processing scripts copied and pasted directly from T-SQL. So a SELECT * FROM x WHERE .... type script works perfectly fine, even if it is quite complex (lots of inner and outer joins, CASE WHEN statements, etc etc).
However, I've run into a problem where the SQL script relies on a temporary disk table. The following script format is running okay (i.e. Qlikview reports no errors and returns back to the application when it has finished and displays the Select Fields box). But no data is returned.
QlikviewTable:
SQL SELECT * INTO #temp FROM dbo.xCould someone tell me what I am doing wrong and how I can fix this? In the above simple example, I need the data from SELECT a, b, SUM(c), COUNT(d) FROM #temp GROUP BY a, b to be returned into the table QlikviewTable. Running the script on my SQL Server gives exactly this.
With thanks
James
try this: TableA: SQL SELECT * FROM dbo.x STORE TableA INTO TableA.qvd; NOCONCATENATE QlikviewTable: LOAD a, b, SUM(c), COUNT(d) RESIDENT TableA GROUP BY a, b; DROP TableA;
Cheers Naveen
try this: TableA: SQL SELECT * FROM dbo.x STORE TableA INTO TableA.qvd; NOCONCATENATE QlikviewTable: LOAD a, b, SUM(c), COUNT(d) RESIDENT TableA GROUP BY a, b; DROP TableA;
Cheers Naveen
Hi!
This works for me:
Temp_Table:
SQL SELECT * INTO temp
FROM dbo."Dim_Dates";
QV_table:
Load *;
Select
DateShortInt,
Count(DateShortInt) as No_Days
From
temp
Group By DateShortInt;
SQL Drop table temp;
[\code]
This gives me 1 table: QV_table. Altough this doesn't drop sql-table temp.
Miikka</body>
It is simpler than that:
temp:
SQL SELECT a,b,c,d FROM dbo.x;
//
QlikviewTable:
LOAD
a,
b,
SUM(c) as SumC,
COUNT(d) as CountD
RESIDENT temp
GROUP BY a, b;
//
DROP TABLE temp;
Would be easy if you encapsulate your T-SDQL code into a stored procedure and then execute with
sql exec yourprocedurename;
Thanks Mikka
Couldn't get this to work but I follow your logic and was able to get it to work by using RESIDENT.
James
Thanks very much to you all for your help.
By using resident I was able to solve my immediate problem.
I'm still not sure this would work if the second chunk of SQL code was particularly complex (because essentially the first bit is SQL, the second is a LOAD statement in a QV script). In this case, I would have to use a stored procedure as Clever Anjos suggested.
A SP would have been the easiest thing to do - if only the IT department allowed me to create my own SPs and Views!! Right now I don't have access to do this, but fortunately, that's going to change soon.
Thanks again
James