# Process data sql table view function issue

**URL:** <https://forum.inductiveautomation.com/t/process-data-sql-table-view-function-issue/34813>\
**Category:** Ignition\
**Tags:** database\
**Created:** [May 16, 2020, 2:11pm UTC](https://forum.inductiveautomation.com/t/process-data-sql-table-view-function-issue/34813 "2020-05-16T14:11:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 16, 2020, 2:11pm UTC](https://forum.inductiveautomation.com/t/process-data-sql-table-view-function-issue/34813/1 "2020-05-16T14:11:05Z")

</div>

BackGround, i have an assembly line, that have many different function machine. Every machine have Key parameter, i store the key data to SQL database every second.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fe2166876670ff58a98fda58760f4ace603d9d66.png)  
i actually want to use view to combine these two table, but i found the timestamp in the sql after second , there are still have 3 number as the following picture shows, so i am not able to use the sql view due to if i decrease the Process B timestamp by 30s it will perfect match with the process A timestamp.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/18cb6d7c6b071399032cf7258c942de08bf3a327.png)

currently i first store the data to a history database as a temp solution , then use scripting to read the data and use transction to SQL server finally, but it will make the a lot of cpu and memory and hard disk . is there any solution to solve this problem ?

---

<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 16, 2020, 2:48pm UTC](https://forum.inductiveautomation.com/t/process-data-sql-table-view-function-issue/34813/2 "2020-05-16T14:48:05Z")

</div>

Timestamps are accurate to milliseconds. Also, using time to tie production on one cell to production on another cell is a terrible idea, as any fluctuation in line speed (including by stoppages) will break your calculation. Plus any rounding issues when timestamps fall close to the 0 millisecond mark.

Use a unique id that follows the product from cell to cell (a re-usable pallet fixture ID, perhaps) and join in SQL with that.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [May 17, 2020, 8:25am UTC](https://forum.inductiveautomation.com/t/process-data-sql-table-view-function-issue/34813/3 "2020-05-17T08:25:29Z")

</div>

Dear Sir i following your advise , and simulate success, thanks a lot

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b3a26ec7063451a5a4119459f5c317a8e13119f4.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7dc2c56a97ad2b0f7a4da983bbd6add1d9e21978.png)  
i create 2 transaction in ignition and use the TSID(a unique id what you suggest me),after the data is stored  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9014952d303f3f26fd42a9cf1a005aee5e9d0a63.png)  
i create view in the sql server side  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c2d61f7405f98c1c4a08dbebd3fef8a2dffee4e7.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/3a77c3fa3ba12ae266d1070817e55d03f882c975.png)  
Finally i can combine these two transaction table together.
