Issue With the “Open SQL Query” Step in TestStand

Updated Oct 28, 2024

Reported In

Software

  • TestStand 2019
  • TestStand 2021
  • TestStand 2021 SP1

Issue Details

I encountered unexpected behaviour when trying to run the following statement in the TestStand: "INSERT INTO [AUX_Test] (Project_Alias) OUTPUT INSERTED.id VALUES ('"+ Locals.Project_Name +"')" by the "Open SQL Statement" step. The sequence runs without any problems, but I have 3 extra rows instead of one in the database. (You can see in attached photo)

MicrosoftTeams-image 1.png

When I execute the same statement in the database, everything works as expected. It created one row.

I tried based on TS 19 and 21, with both I got the same issue.

Solution

This is a bug and has been documented in Bug 2187652. NI does not guarantee that each release will have all bugs fixed.

A potential workaround for this is the following:

1. You need to put in the False statement "Identity" from the Column Properties. You can go into this article or contact your IT for this.

1.1 You may check your identity status by going to your DB table

Screenshot 2022-10-18 140338

1.2 Expand tree view:

Screenshot 2022-10-18 140704

1.3 From here expand the tree view of the Columns folder

Screenshot 2022-10-18 140704

1.4 Then by right-clicking by "ID", go to the property section

Screenshot 2022-10-18 141022

1.5 And in the pop-up window, you will see it (it should be False)

Screenshot 2022-10-18 141141

2. After completing the first step, please go to the sequence file in the TestStand.

   2.1 Go to the step "Insert into Aux table" and open Edit Open SQL Statement.

   2.2 Then modify SQL statement. You will need to add a table and a column after INSERTED.ID there, as shown below:

  "INSERT INTO [AUX_Test] (Project_Alias) OUTPUT INSERTED.ID INTO [New_AUX_Test_2] (ID) VALUES ('" + Locals.Project_Name + "')"

   2.3 To do test