02-23-2010 09:23 AM
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.
09-30-2010 03:12 PM
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.