# Change the column length when automatically create table And Insert

**URL:** <https://forum.inductiveautomation.com/t/change-the-column-length-when-automatically-create-table-and-insert/98453>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 11, 2024, 6:16am UTC](https://forum.inductiveautomation.com/t/change-the-column-length-when-automatically-create-table-and-insert/98453 "2024-11-11T06:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Tsai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Sam\_Tsai](https://forum.inductiveautomation.com/u/Sam_Tsai)\
**Post date:** [November 11, 2024, 6:16am UTC](https://forum.inductiveautomation.com/t/change-the-column-length-when-automatically-create-table-and-insert/98453/1 "2024-11-11T06:16:39Z")

</div>

Is there any way to change the column length when a transaction group creates a new column or table? I want to set the default column type to `nvarchar(MAX)` without manually executing the ALTER script in the database.

And if the string length exceeds 4000 characters, it will be truncated to 4000 because Ignition sets the parameter as `nvarchar(4000)` when the transaction group inserts data into the data table. Is there any way to change it to `nvarchar(MAX)`?

Meanwhile, I’m trying to prevent my string from being truncated by creating a new tag change event in the gateway. However, I found that the `INSERT` SQL executed by the transaction group runs after the SQL executed by tag changes. This seems unreasonable to me.

When my tag `a` is set to `true`, it should trigger the transaction group to insert the information into the data table at that moment. After that, the transaction group should reset tag `a` to `false`, triggering my tag change event to execute an `UPDATE` SQL statement. The `UPDATE` SQL should execute after the `INSERT`, so why does the `UPDATE` execute first?

Thanks~

---

<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:** [November 11, 2024, 12:46pm UTC](https://forum.inductiveautomation.com/t/change-the-column-length-when-automatically-create-table-and-insert/98453/2 "2024-11-11T12:46:54Z")

</div>

> [@Sam\_Tsai](#):
>
> Ignition sets the parameter as `nvarchar(4000)`

Legacy DB version support, I suspect. I don't think there's any way to change that.

> [@Sam\_Tsai](#):
>
> The `UPDATE` SQL should execute after the `INSERT`, so why does the `UPDATE` execute first?

Are you routing through the Store and Forward system for the transaction group? That will delay its actual SQL execution.

---

<div class="post-metadata">

**Author:** ![Sam\_Tsai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Sam\_Tsai](https://forum.inductiveautomation.com/u/Sam_Tsai)\
**Post date:** [November 12, 2024, 1:45am UTC](https://forum.inductiveautomation.com/t/change-the-column-length-when-automatically-create-table-and-insert/98453/3 "2024-11-12T01:45:02Z")

</div>

Thanks for answering my questions.  
I'll confirm that with Ignition support.
