# How Call a Stored Procedure in SQL Query on Report

**URL:** <https://forum.inductiveautomation.com/t/how-call-a-stored-procedure-in-sql-query-on-report/12788>\
**Category:** General Discussion\
**Created:** [March 14, 2017, 9:57pm UTC](https://forum.inductiveautomation.com/t/how-call-a-stored-procedure-in-sql-query-on-report/12788 "2017-03-14T21:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Pacheco](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@Marco\_Pacheco](https://forum.inductiveautomation.com/u/Marco_Pacheco)\
**Post date:** [March 14, 2017, 9:57pm UTC](https://forum.inductiveautomation.com/t/how-call-a-stored-procedure-in-sql-query-on-report/12788/1 "2017-03-14T21:57:53Z")

</div>

Hello, i cant call a stored procedure from my sql query on report designer. I watch online video, but i need something diferent.

i Have a SP in SQL Server:

USE [FM\_HBW]  
GO

DECLARE @return\_value int

EXEC @return\_value = [dbo].[Prueba]

SELECT ‘Return Value’ = @return\_value

GO

but i don´t know how call in ignition report designer

I try with this form:  
call = system.db.createSProcCall(“Prueba”)  
system.db.execSProcCall(call)

but don´t work.  
Thanks for us help

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [March 15, 2017, 3:04am UTC](https://forum.inductiveautomation.com/t/how-call-a-stored-procedure-in-sql-query-on-report/12788/2 "2017-03-15T03:04:29Z")

</div>

Hi Marco,

After you execute the stored procedure you get the results by calling call.getResultSet(). Here is an example:

`call = system.db.createSProcCall("Prueba")
system.db.execSProcCall(call)
results = call.getResultSet()
table = event.source.parent.getComponent("Table")
table.data = results`The example above gets the result from the stored procedure and sets the data in a table that is in a window.

Best,
