NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

can't execute stored procedure(MS SQL)

Hi All,

 

I have problems to use TestStand Database step types to execute a MS SQL stored procedure

I used Open SQL Statement step with SQL Statement as

"spStoredProcedure @parameter1 = 'A', @parameter2 = 'B';"

or "spStoredProcedure 'A', 'B';" or "EXEC spStoredProcedure @parameter1 = 'A', @parameter2 = 'B';"

But none of them return back the recordset, the number of records returned is always -1

I use "Use Default" for all options under Advanced tab.

The stored procedure works fine within SQL Studio or LabVIEW for all expressions. If I replace "spStoredProcedure @parameter1 = 'A', @parameter2 = 'B';" with the real contents of the stored procedure, the Open SQL Statement step returns back the correct records number.

 

I never have this problem with My SQL (ODBC drivers). Can somebody correct me or give me an example to execute a MS SQL stored procedure with parameter

Chenny Zhenyu Wang
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 1 of 4
(4,204 Views)

I also tried another stored procedure with no parameters, the record number is still -1.

 

TestStand 4.2.1; MS SQL Server 2005/2008 R2

Chenny Zhenyu Wang
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 4
(4,202 Views)

Why are you not selecting 'Stored Procedure' as the command type?

0 Kudos
Message 3 of 4
(4,180 Views)

I did. The Number of Records Selected still returns -1.

For My SQL, I use "Use Default" for all settings, and it works fine.

For MS SQL, I've tried various combinations, none of them work.

Chenny Zhenyu Wang
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 4
(4,177 Views)