06-07-2016 05:27 AM
Hello,
I'm a newbie in using TestStand, databases and SQL, and now I have faced trouble. I'm using TestStand 2014 (32-bit).
I have a need to find the number of rows in a database and save that number to a local variable. I have tried to practise using the Database Step Types provided with TS. I tried using the following in a SQL Statement:
Locals.NumberOfRows = ("SELECT COUNT(*) FROM TEST_TABLE")
It returns an error: Specified value does not have the expected type. Can my goal be achieved this way, or am I doing this completely wrong?
-RautSa
Solved! Go to Solution.
06-07-2016 05:38 AM
RauTa,
first check the data type of your SQL statement. I am not sure if you get a numeric here...
Second: Why would you ever want to know this?
Norbert
06-08-2016 04:25 AM
Thank you for your reply, Norbert. I have a database which gains new values randomly, and sometimes I need the exact number of rows in that array.
I managed to accomplish my goal by using SQL Statement: "SELECT COUNT(*) as Rowcount FROM TEST_TABLE", followed by a data operation GET, which saves that Rowcount to a local variable.
-RautSa