Purchase: Save PI Error - Value was ether too large or too small for an lnt 16

From AutoCount Resource Center
Jump to navigation Jump to search

Question : When I try to save a new Purchase Invoice, system prompts an error message "Value was ether too large or too small for an lnt 16.Couldn’t store <32768> in Seq Column. Expected type is lnt 16.”. What should I do?

Int16 1.png


Possible Reason :

Seq column in SQL table reaches maximum value and system not able to update when saving this transaction.


Solution :

1. Click on Show Details to check the error, it’s regarding the UTDStockCostDTL table.

Int16 2.png


2. Login to SQL Management Studio

2.1) Execute the SQL query as below : -

SELECT * FROM UTDStockCost WHERE itemcode='00001'

Int16 3.png

Take note of the UTDStockCostKey is 17351, this info will be needed in the next SQL query.

2.2) Execute the 2nd SQL query as below : -

select * from UTDStockCostDTL where UTDStockCostKey = '17351'

Int16 4.png

The result show 32767 rows. The column for Seq is using smallint data type which the maximum value is 32767. System refused to save the transaction as it reaches the maximum value.


2.3) Do a Backup before executing the following query. Contact your dealer if there is any doubt on the query.

ALTER TABLE UTDStockCostDTL ALTER COLUMN [Seq] [int] NOT NULL

Int16 5.png

It changed to int data type which the maximum value is 2,147,483,647.


2.4) Try again to save the Purchase Invoice, and should be save successfully.

New row is updated to SQL Table.

Int16 6.png



By : CK 180926, Lay Swan 180928, P181015



Go to menu

IconAcc20.PNG AutoCount Accounting 2.0


IconAcc188.PNG AutoCount Accounting 1.8 / 1.9
Wiki-Payroll.png AutoCount Payroll
Wiki-POS.PNG AutoCount POS
Wiki-AOTG.PNG AutoCount On The Go
Wiki-Accounting-Plugin.png AutoCount Accounting Plug-In Documentations