# Can query SQL tables, but cannot query SQL views, GatewayException: Unknown SQL type: -156

**URL:** <https://forum.inductiveautomation.com/t/can-query-sql-tables-but-cannot-query-sql-views-gatewayexception-unknown-sql-type-156/43877>\
**Category:** Ignition\
**Tags:** database\
**Created:** [February 26, 2021, 4:26pm UTC](https://forum.inductiveautomation.com/t/can-query-sql-tables-but-cannot-query-sql-views-gatewayexception-unknown-sql-type-156/43877 "2021-02-26T16:26:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yzhang](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yzhang](https://forum.inductiveautomation.com/u/yzhang)\
**Post date:** [February 26, 2021, 4:26pm UTC](https://forum.inductiveautomation.com/t/can-query-sql-tables-but-cannot-query-sql-views-gatewayexception-unknown-sql-type-156/43877/1 "2021-02-26T16:26:51Z")

</div>

GatewayException: Unknown SQL type: -156  
caused by SQLException: Unknown SQL type: -156

Ignition v8.0.16 (b2020082513)  
Java: Azul Systems, Inc. 11.0.7

**Other information:SQL version: 13.0.4001.0**

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [February 26, 2021, 6:37pm UTC](https://forum.inductiveautomation.com/t/can-query-sql-tables-but-cannot-query-sql-views-gatewayexception-unknown-sql-type-156/43877/2 "2021-02-26T18:37:29Z")

</div>

What version of the JDBC driver is your gateway using?  
We had to upgrade the driver when we went to SQL Server 2016

---

<div class="post-metadata">

**Author:** ![yzhang](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@yzhang](https://forum.inductiveautomation.com/u/yzhang)\
**Post date:** [February 26, 2021, 6:49pm UTC](https://forum.inductiveautomation.com/t/can-query-sql-tables-but-cannot-query-sql-views-gatewayexception-unknown-sql-type-156/43877/3 "2021-02-26T18:49:01Z")

</div>

Finally it is because in the view I am using the sql variant type for a column, I did a cast in the view, now everything is perfect now. Thanks.
