Passing variable to SQL query

sql

#1

Hello guys,

I was trying to pass variable (by parameter option) to my SQL query.

Blockquote
“Select START_DATE, NRB
FROM blabla.blablaT_V
Where START_DATE between” + date1 + “And ‘07/21/2018’”
Blockquote
Date1 is a variable passed to SQL query
But still get error.

I can only pass query with variable as whole as variable (so lets say date2 = “Select START_DATE, NRB
FROM blabla.blablaT_V
Where START_DATE between ‘07/01/2018’ And ‘07/21/2018’”

How can I pass variable to query without creating whole text before?

best regards


#2

Okay, I have found a solution ->
SQL query must be a one line to pass variable from outside (passed by parameter).