# Expression in an Update or Select Query not working

**URL:** <https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529>\
**Category:** Procedural SQL\
**Created:** [May 15, 2022, 6:37am UTC](https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529 "2022-05-15T06:37:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manoj](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@manoj](https://www.singlestore.com/forum/u/manoj)\
**Post date:** [May 15, 2022, 6:37am UTC](https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529/1 "2022-05-15T06:37:32Z")

</div>

I maybe missing somethin simple to explain what is going on. I am trying to get another problem solved and I encountered the following issue that is very different from other DB’s I use.

I have the following query:

**1. Update un\_hi\_device\_loc Set un\_hi\_rec\_id = my\_ts\_unix**

This results in the un\_hi\_rec\_id field to be set correctly with the my\_ts\_unix value from the associated row

**2. Update un\_hi\_device\_loc Set un\_hi\_rec\_id = my\_ts\_unix / 10**

This results in a 0 set in the column un\_hi\_rec\_id for all rows the table

What is happening whenever I add, subtract, divide, or multiply the my\_ts\_unix field value? It does not do the expected mathematical calculation. The my\_ts\_unix is a LONG type. The same results happen if I run the same tests with a SELECT statement

---

<div class="post-metadata">

**Author:** ![MariaSilverhardt](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/mariasilverhardt/32/828_2.png) [@MariaSilverhardt](https://www.singlestore.com/forum/u/MariaSilverhardt)\
**Post date:** [June 1, 2022, 2:01pm UTC](https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529/2 "2022-06-01T14:01:30Z")

</div>

Good day Manoj!

From my understanding, math operations should work fine in SingleStore.

Is the other datatype for un\_hi\_rec\_id an INT?

Please remember to make sure that the values are within the range of the datatype because an INT value only goes up to of 2,147,483,647

[Here](https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-types/integer-numbers.html) are the numerical datatypes and some more info from our docs.

Keep us posted on your tests. Good luck! 🍀

---

<div class="post-metadata">

**Author:** ![manoj](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@manoj](https://www.singlestore.com/forum/u/manoj)\
**Post date:** [June 1, 2022, 2:39pm UTC](https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529/3 "2022-06-01T14:39:15Z")

</div>

This issue is tied to me using a Pipeline with a UNICODE CSV file, instead of an ASCII file. Your doc state UNICODE in many places so I assumed the CSV should be UNICODE. That only works for TEXT type and not any other types. The issue of this thread was related to the CSV coming in as UNICODE. So the issue is resolved.

---

<div class="post-metadata">

**Author:** ![MariaSilverhardt](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/mariasilverhardt/32/828_2.png) [@MariaSilverhardt](https://www.singlestore.com/forum/u/MariaSilverhardt)\
**Post date:** [June 2, 2022, 10:03pm UTC](https://www.singlestore.com/forum/t/expression-in-an-update-or-select-query-not-working/4529/4 "2022-06-02T22:03:02Z")

</div>

Glad to hear it! Yay! 🥳 Thanks so much for the update, Manoj! You rock 🎸
