NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Assign locals from SQL-database

How to assign locals from SQL-database and how to use locals in SQL-statement.
0 Kudos
Message 1 of 2
(2,792 Views)
There's a shipping example called WritingAndReadingTableData.seq (in v2.0 anyway) that should help. In the example, a Data Operation of Get, reads a column value and writes it to a local variable. You can insert a local variable into the SQL statement that you create in the Open SQL Statement step type. In the above example, there's the statement

"SELECT TEST_TABLE.COL_COUNTER, TEST_TABLE.COL_STRING, TEST_TABLE.COL_INTEGER, TEST_TABLE.COL_DOUBLE, TEST_TABLE.COL_CURRENCY, TEST_TABLE.COL_BOOLEAN, TEST_TABLE.COL_DATE FROM TEST_TABLE"

If you had a local variable called TableName and value of "TEST_TABLE" assinged to it, the statement could just as easily be

"SELECT TEST_TABLE.COL_COUNTER, TEST_TABLE.COL_STRING, TEST_TABLE.COL_INTEGER, TEST_TABLE.COL_DOUB
LE, TEST_TABLE.COL_CURRENCY, TEST_TABLE.COL_BOOLEAN, TEST_TABLE.COL_DATE FROM " + locals.TableName
0 Kudos
Message 2 of 2
(2,792 Views)