sql server - How to execute multi-stated SQL in QlikView script? -


i have ms-sql query, using temporary table, i'd data qlikview:

declare @oi_im table (tick datetime);  insert @oi_im select top 360 dateadd(mi, datediff(mi, 0, getdate()) - row_number() on (order id), 0) tick [messages] timer;  select tick created, case when msgs null 0 else msgs end msgs (select top 360 tick @oi_im) timer left join (select top 360 dateadd(mi, datediff(mi, 0, created), 0) created, count(*) msgs   [messages] with(nolock)   group dateadd(mi, datediff(mi, 0, created), 0)   order created desc) msgslist on msgslist.created=timer.tick order timer.tick desc 

my first try copy text qlickwiev "edit script" window, problem - script throws statements sql 1 one. after making first statement (make temporary table) ms sql server loses context, , on second statement produces error "i don't know @oi_im"

next try wrap text stored procedure:

sql execute sp_executesql n'declare @oi_im table (tick datetime);   insert @oi_im select top 360 dateadd(mi, datediff(mi, 0, getdate()) - row_number() on (order id), 0) tick [messages] timer with(nolock);   select tick created, case when msgs null 0 else msgs end msgs (select top 360 tick @oi_im) timer left join (select top 360 dateadd(mi, datediff(mi, 0, created), 0) created, count(*) msgs   [messages] with(nolock)   group dateadd(mi, datediff(mi, 0, created), 0)   order created desc) msgslist on msgslist.created=timer.tick order timer.tick desc ' 

it produces no error, unfortunately returns no data @ all.

so question is: how execute multi-stated sql in qlikview script, while first sql statement not select?


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -