Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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.