Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sql query

hi

I am trying to run a sql query in qlikview where in i am creating a temporary table #temp_table

then updating this table with different parameters and conditions

and then select * from #temp_table

script runs fine in sql but in qlikview script is running fine and no data is loaded

regards

peter

10 Replies
Not applicable
Author

Can you post the script you have written? Have you been successful in loading data through SQL Query before?
Not applicable
Author


[CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Initial Catalog=DATABASE;Data Source=SRV;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PC1;Use Encryption for Data=False;Tag with column collation when possible=False]
sql
use Database
set nocount on
create table tmp_booking_leg
(book_no char(16),
carrier_id char(04),
book_date datetime,
leg_no smallint,
voyage_desc varchar(50) null,
load_port_id char(05) null,
discharge_port_id char(05) null,
etd_date datetime,
eta_date datetime,
load_agency_id char(03),
prev_eta_date datetime null,
days smallint,
maincarriage_leg_no smallint null,
maincarriage_voyage_desc varchar(50) null,
maincarriage_service_id char(04) null
)]






Not applicable
Author

hi

this query is running fine in sql server but not in qlikview

Not applicable
Author

Hey, this is not a select query, right? You can only retrieve data from database. Making changes like insertion and creating tables is not possible from QlikView.
Not applicable
Author

ok

but i have done this where the data is inserted in to the microsoft access database

Not applicable
Author

Even in Acess, you won't be able to do insertion. Why do you want to create a temporary table in Access. If you want, you can load the data, create a temporary table in qlikview and use it.
Not applicable
Author

ok

how can i create a temporary table in qlikview and update that table with data from different tables

Not applicable
Author

I will just try to put a simple example here.
QVTable1:Load *;SQL Select A, B, C from table1 ;

Now you can use this table anywhere in Script using Resident:

QVTable2:Load A, B, (C+10) as DResident QVTable1;

Even operations like join, concatenate and alll are possible betweeen different tables loaded in qlikview. Refer the help document for more details.

Not applicable
Author

Why do you need to run all this in QV? I'd suggest creating a stored procedure that loads parameters and values into temps, and do the select .