# Using system.db.execSProcCall

**URL:** <https://forum.inductiveautomation.com/t/using-system-db-execsproccall/4540>\
**Category:** Ignition\
**Created:** [May 29, 2012, 12:43am UTC](https://forum.inductiveautomation.com/t/using-system-db-execsproccall/4540 "2012-05-29T00:43:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hari2012](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@hari2012](https://forum.inductiveautomation.com/u/hari2012)\
**Post date:** [May 29, 2012, 12:43am UTC](https://forum.inductiveautomation.com/t/using-system-db-execsproccall/4540/1 "2012-05-29T00:43:13Z")

</div>

I have two databases and accordingly there are two database connections configured in the project.  
One db connection is configured as a defualt connection in the project.

In one of the windows, I would like to generate a dataset for use with a bar chart. I am using the ‘system.db.execSProcCall’ to run the stored procedure and generate the dataset. The problem I am having is the stored procedure/data resides in the database that is not associated with the default connection of the project. How can I specify the connection the program needs to use when calling this stored procedure? In some of the property window, I have see there is an option which db connection the event handler should use. But I do not see that option in the script window. I did not find any functions which I can use to specify the connection. I appreciate any help on how to resolve this issue

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [May 29, 2012, 1:51pm UTC](https://forum.inductiveautomation.com/t/using-system-db-execsproccall/4540/2 "2012-05-29T13:51:39Z")

</div>

You just need to specify the database name when you create the SProcCall object.

```auto
call = system.db.createSProcCall("theNameOfYourQuery", "DatabaseName")
system.db.execSProcCall(call)
```

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 7, 2012, 6:53pm UTC](https://forum.inductiveautomation.com/t/using-system-db-execsproccall/4540/3 "2012-06-07T18:53:28Z")

</div>

Don’t forget that the [user manual](http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?system_db_createsproccall.htm) details all of the possible parameters for each scripting function.
