NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm using TestStand/Labview/SQL to do a query. Can you use a variable name in SQL instead of quotes around a value?

I'm using TestStand 2.0/Labview 6i with SQL open statement to do a query. Can you use a variable name with the SQL statement instead of quotes around a value? See example below.

SELECT * FROM STEP_COMMANDS WHERE STEP_COMMANDS.SPEC_NUMBER = '4.5'

I would like to use a variable instead of '4.5'. SPEC_NUMBER is a string type.

SELECT * FROM STEP_COMMANDS WHERE STEP_COMMANDS.SPEC_NUMBER = 'SPEC_NUMBER'
0 Kudos
Message 1 of 2
(2,732 Views)
You can use a variable with the right syntax. For example, in the SQL Statement window, use:

"SELECT * FROM STEP_COMMANDS WHERE STEP_COMMANDS.SPEC_NUMBER = '" + Locals.SPEC_NUMBER +'"

At run-time, the expression will be evaluated.
Message 2 of 2
(2,732 Views)