Stored procedure

I haven’t worked with stored procedures before, inside or outside of Ignition.

Have been given one to setup, have attached a text file with the SP, errors I get trying to run in database browser. Then tried a script to call it, and I get 36 columns returned but 0 rows, the other attchement comes from MS SQL Mgmt Studio, it has 36 columns too so appears I am getting close.

Thought the error might have been that it was returning two datasets, so split the SP into _A and _B but get the same errors.

First thing tried was checking this was off: Microsoft SQL Server - "Result set was generated for update"

Any suggestions?automation SP.txt (932 Bytes)
automation SP.txt (932 Bytes)
Copy of Automation (2).xls (25 KB)

Edit: UltimatelyI will need the barcode coming in with ? placeholder

Sorted,

barcode = ‘0184956500500000’
results_A = system.db.runPrepQuery(“exec reporting.dbo.usp_Automation_GetFrameDetails_A @barcode = ?”, [barcode])
print results_A
columnHeaders = system.dataset.getColumnHeaders(results_A.getUnderlyingDataset())
print dict(zip(columnHeaders, results_A[0]))

results_B = system.db.runPrepQuery(“exec reporting.dbo.usp_Automation_GetFrameDetails_B @barcode = ?”, [barcode])
print results_B
columnHeaders = system.dataset.getColumnHeaders(results_B.getUnderlyingDataset())
for x in range(0,10):
print dict(zip(columnHeaders, results_B[x]))

OK another question, was mucking about with this earlier for about half an hour before giving up and moving on to something more productive;

in the attached image I only want a return if the result is not zero, have tried many different ways of that and I either get nothing back or get the zero results back… so in attachment I only want “630” back when z index is 21.

I have 36 columns but the majority of the time only 8 are populated with data, when I run this on a table I only want 8 columns displayed not 36 with loads of ‘0’ values