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

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

Set a Variable in Edit Script

How do I set a variable equal to the results of a SQL query?

for example let x = select dbname from table

1 Solution

Accepted Solutions
Not applicable
Author

You can do it otherway, store the sql query output in table and after that, using peek function you can assign it to any variable.

SQLTableList:

          LOAD Name as TableNames;

          SELECT Name From AdventureWorksDW2008R2.sys.tables;

let vMyTableName = Peek('TableNames',0,'SQLTableList');

Hope this helps.

View solution in original post

1 Reply
Not applicable
Author

You can do it otherway, store the sql query output in table and after that, using peek function you can assign it to any variable.

SQLTableList:

          LOAD Name as TableNames;

          SELECT Name From AdventureWorksDW2008R2.sys.tables;

let vMyTableName = Peek('TableNames',0,'SQLTableList');

Hope this helps.