Purchase: Save PI Error - Value was ether too large or too small for an lnt 16
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?
Possible Reason :
Seq column in SQL table reaches maximum value and system not able to update when saving this transaction.
1. Click on Show Details to check the error, it’s regarding the UTDStockCostDTL table.
2. Login to SQL Management Studio
2.1) Execute the SQL query as below : -
SELECT * FROM UTDStockCost WHERE itemcode='00001'
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'
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
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.
By : CK 180926, Lay Swan 180928, P181015
|AutoCount Accounting 2.0
|AutoCount Accounting 1.8 / 1.9
|AutoCount On The Go
|AutoCount Accounting Plug-In Documentations