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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
sims
Contributor II
Contributor II

How to declare SQl variables in Qlik sense script

How can I declare the SQL variable below in Qlik sense script and use them in the SELECT statement.

Thanks in advance.

DECLARE @startDate DATETIMEOFFSET = NULL
 DECLARE @endDate DATETIMEOFFSET = NULL
 DECLARE @transactionDateTimeFromLocal DATETIME = CONVERT(DATETIME, SWITCHOFFSET(@startDate, '+00:00'))
DECLARE @transactionDateTimeToLocal DATETIME = CONVERT(DATETIME, SWITCHOFFSET(@endDate, '+00:00'));

SELECT

-------

 

2 Replies
dbodlovich
Contributor
Contributor

hi!, i have the same doubt, did you solve it?

Or
MVP
MVP

You can use SET or LET to set Qlik variables and then use those in your select statements. See e.g. https://community.qlik.com/t5/QlikView-App-Dev/Can-QV-use-variables-in-SQL-SELECT/m-p/38883