# SQl-query from the non default database

**URL:** <https://forum.inductiveautomation.com/t/sql-query-from-the-non-default-database/12146>\
**Category:** Ignition\
**Created:** [September 21, 2016, 7:42pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-the-non-default-database/12146 "2016-09-21T19:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jado58](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Jado58](https://forum.inductiveautomation.com/u/Jado58)\
**Post date:** [September 21, 2016, 7:42pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-the-non-default-database/12146/1 "2016-09-21T19:42:40Z")

</div>

Hello,

Im trying to query a table located in a database that is not the default for the project, I don’t know how to set set it up, the example below is not working.

`select * 
from [ServerName(IP)].[EVVThermoOperations].[dbo].[StoreRoomInventory]`

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [September 22, 2016, 6:57am UTC](https://forum.inductiveautomation.com/t/sql-query-from-the-non-default-database/12146/2 "2016-09-22T06:57:13Z")

</div>

If that’s in a Query Tag, you have to make sure the correct Datasource is selected under the query.  
If the database you’re after is not available in the Datasource list it will need to be added under Configure-\>Connections on the Gateway web page.

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![Jado58](https://avatars.discourse-cdn.com/v4/letter/j/cdc98d/32.png) [@Jado58](https://forum.inductiveautomation.com/u/Jado58)\
**Post date:** [September 23, 2016, 8:32pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-the-non-default-database/12146/3 "2016-09-23T20:32:09Z")

</div>

Oh how did I miss that 😆 , thanks !
