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 statement with a cursor in it

Hi there,

I have an SQL Server script that is briefly something as following:

Declare someting ...



TABLE #tempTable

......



DECLARE



db_cursor CURSOR

FOR

select.....



.....







FETCH NEXT FROM db_cursor INTO .....

WHILE

@@FETCH_STATUS = 0



BEGIN

insert

into #tempTable....

END

......



It is working well in SQL Server.

When it comes to executing it in QV, I have tried to put a "sql" expression at the beginning and ";" at the and of the QV script. QV does not realize it. For info, I dont have a permission to create a stored procedure in the database.

Any solution? Thanks in advance.









2 Replies
Not applicable
Author

It is an old post I konw but I am curious if you figured this out? Has anyone used cursors in qlikview scripts?

Not applicable
Author

putting any complicated SQL inside an exec usually does the trick...

exec ('    T-SQL   ')

Don't forget to double any quotes inside the script.