# Leading Zero MySQL Perspective Table

**URL:** <https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722>\
**Category:** Ignition Early Access\
**Tags:** database\
**Created:** [July 19, 2019, 5:09pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722 "2019-07-19T17:09:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [July 19, 2019, 5:09pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722/1 "2019-07-19T17:09:06Z")

</div>

Hey guys,

As always I appreciate any help. I have a perspective table. It’s cutting off leading zero on a simple select query. Colum is zero-filled in the table. Do I need to Lpad() the query? Can’t get it to work in query currently. But shouldn’t the table have the exact values from sql table?

 ![leading%20zeros](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/912408c0852ce3087dab4144c1035db967fe4948.jpeg)

 ![Screenshot%20(4)](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/05eca1e3947bc53fc4b6934ea1adcb7fe3833ec5.png)

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [July 19, 2019, 5:25pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722/2 "2019-07-19T17:25:31Z")

</div>

Is the data type of the database column a string type or a number type?

If it’s a string type, just set the table column’s `render` property to `string`.

If it’s being stored as a number then yes, you’ll need to left pad it yourself and again, set the column `render` property to `string`.

EDIT: I can see now that you didn’t actually set up any of your columns in the table, you just let them be handled automatically. You’ll need to manually add the columns in the table component and set them up so that the first column is rendered as a string, because right now it’s automatically detecting that it’s a number. And again, if the data is being brought in as a number, you’ll have to left pad it yourself - probably through a scripting transform.

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [July 19, 2019, 5:38pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722/3 "2019-07-19T17:38:27Z")

</div>

It was an INT(3). Its now a String(3). Thanks man!!

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 19, 2019, 6:06pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722/4 "2019-07-19T18:06:01Z")

</div>

I was also going to suggest using `ZEROFILL()`, but I see that’s deprecated in MySQL 8-point-something. :shakes fist at MySQL:

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [July 19, 2019, 6:53pm UTC](https://forum.inductiveautomation.com/t/leading-zero-mysql-perspective-table/26722/5 "2019-07-19T18:53:49Z")

</div>

Lol. Good to know going forward. Because it was zero filled. Or was before it was changed to varchar. Thanks!
