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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Judicael
Partner - Contributor III
Partner - Contributor III

Variable in schema SQL Statement

Hi,

What is the correct statement, i see an error message... 

LET vTableSchema ='Appollon';

LOAD TABLE_NAME AS TableNames;
SELECT DISTINCT TABLE_NAME FROM information_schema.tables
WHERE table_schema=$(vTableSchema)  AND TABLE_NAME IN (
'countries', 'adventures_professionnal');

 

Regards,

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith

Another alternative to Vegar's response is changing your LET to SET--then the single quotes will stay within the variable and you don't need to add them in the SQL.

View solution in original post

2 Replies
Vegar
MVP
MVP

My best guess is that you need quotes around your variable expansion. Like this:

... 

WHERE table_schema='$(vTableSchema)' 

Nicole-Smith

Another alternative to Vegar's response is changing your LET to SET--then the single quotes will stay within the variable and you don't need to add them in the SQL.