# Perspective table Query binding MSSQL error

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 27, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946 "2022-04-27T17:55:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![imt.sebastian.sanche](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@imt.sebastian.sanche](https://forum.inductiveautomation.com/u/imt.sebastian.sanche)\
**Post date:** [April 27, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/1 "2022-04-27T17:55:41Z")

</div>

I created a named query and when I run it in the testing area it gives me back the data correctly.  
When I want to bind it to a table in perspective it says there is an error next to “FROM” but I don’t understand how there is an error if it works correctly in the named query.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/7/f7cdb7de1b99449b7fabd3e57cccd7e4f8a0563e.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 27, 2022, 5:57pm UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/2 "2022-04-27T17:57:02Z")

</div>

Regardless of the inconsistency, that error is coming from MSSQL/their driver, not Ignition code.

---

<div class="post-metadata">

**Author:** ![imt.sebastian.sanche](https://avatars.discourse-cdn.com/v4/letter/i/ecb155/32.png) [@imt.sebastian.sanche](https://forum.inductiveautomation.com/u/imt.sebastian.sanche)\
**Post date:** [April 27, 2022, 7:16pm UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/3 "2022-04-27T19:16:54Z")

</div>

So just if somebody comes around this again. The connection to the datasource was modified with the gateway open. When I closed it and open it again the error was gone, hence the inconsistency.

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [May 30, 2023, 4:38am UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/4 "2023-05-30T04:38:46Z")

</div>

Hi,  
I am binding named query in table. showing error.  
In query I have used temp tables. The query is working fine in SQL SERVER and getting results also. but in ignition I am getting error.  
but testing in named query getting values.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/b/3bca3e90c77607176778f8a4de6409830a07fa6d.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9f329ce21ca3c3e674b7c6a40cda864003f6f793.png)

second point is , I am able to bind other named query.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dccf7d8588d9a0aa16538d719a2c83f99d570587.png)

So, where is the problem I am not getting.

Please help

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [May 30, 2023, 4:56am UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/5 "2023-05-30T04:56:36Z")

</div>

after edited,  
parameters value set to 1, I am getting the results.

how it differ, I didn't understand.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/a/0a74965eb1c13efe4f8dc78c88d4808a94003e58.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2023, 12:15pm UTC](https://forum.inductiveautomation.com/t/perspective-table-query-binding-mssql-error/58946/6 "2023-05-30T12:15:03Z")

</div>

1. You have to provide values for named query parameters. If you don't, they are delivered as NULLs, which screws up many queries.

2. You are using SQL scripts, not SQL statements, so your work will not be portable and will be subject to changes in IA's implementation. JDBC, which IA leverages, doesn't support scripts, just single statements. Some JDBC drivers, like Microsofts, allow them, but IA's implementation has some gotchas. If you need scripts to run in the DB, you should be creating stored procedures.

{Testing in SQL Server Management Studio is not sufficient to know if a query should work through JDBC, since SSMS doesn't use JDBC.}
