# Siemens UINT to SQL

**URL:** <https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661>\
**Category:** Ignition\
**Created:** [June 29, 2017, 10:55pm UTC](https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661 "2017-06-29T22:55:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimjohnson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jimjohnson](https://forum.inductiveautomation.com/u/jimjohnson)\
**Post date:** [June 29, 2017, 10:55pm UTC](https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661/1 "2017-06-29T22:55:35Z")

</div>

I have a tag for a UInt16 (2 byte unsigned integer) in a Siemens PLC that I am trying to cross over to a SQL table correctly. I tried using all the integer types on the properties of the tag, and none of them change the value from being negative when greater than 32767. Does anyone know a fix for this?

I also tried to create an expression tag with this expression, but I have something wrong, and it gives me a Config error:  
if({[~]ST102/Recipe Save/Last Edited By} \>= 0,{[~]ST102/Recipe Save/Last Edited By},65536-{[~]ST102/Recipe Save/Last Edited By})

---

<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:** [June 30, 2017, 1:24am UTC](https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661/2 "2017-06-30T01:24:53Z")

</div>

try:

```auto
{[~]ST102/Recipe Save/Last Edited By} & 65535

```

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [June 30, 2017, 7:21am UTC](https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661/3 "2017-06-30T07:21:18Z")

</div>

If you want to use UInt in Ignition, you must specify byte or word or doubleword in OPC Item Path:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/958f7b380f280a0e16a35b2d2a630e65f89dd99e.PNG)  
If you put **DB1,W2** , values are from 0 - 65536, if you put **DB1,I2** , values are -32767 to 32767.

---

<div class="post-metadata">

**Author:** ![jimjohnson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@jimjohnson](https://forum.inductiveautomation.com/u/jimjohnson)\
**Post date:** [June 30, 2017, 2:21pm UTC](https://forum.inductiveautomation.com/t/siemens-uint-to-sql/14661/4 "2017-06-30T14:21:38Z")

</div>

Thanks so much! The “W” did the trick.
