ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Update new record in database table

I'm working with TestStand 4.2 and MySQL database with user-defined tables.

 

There is "test_results" table with autoincrement "id" (primary index).

 

I want to:

1. write a new record to the test_results table - some data and status "Running"

2. run a test (pass to a test sequence its "id", test uses this id for writing data to database)

3. update the record: set execution time and update status.

 

So, the steps are as below:

1. Open database

2. Open SQL statement: "select * from test_results".

3. Data Operation: operation - "Set and Put", record to operate on - "New - Create New Record". In the "Column/Parameter Values" tab I set the new record values.

 

Here I want to retrieve the new record "id". How to do it?

 

 

Thanks in advance.

0 Kudos
Message 1 of 2
(3,443 Views)

I am not sure how to implement this in Test Stand, but from an SQL programming perspective, you want to run:

 

SELECT @@IDENTITY

 

Here is a link to the description:  http://msdn.microsoft.com/en-us/library/ms187342.aspx

 

It will retrieve the record ID of the row you just inserted.

http://www.medicollector.com
0 Kudos
Message 2 of 2
(3,223 Views)