Conversion of the nvarchar value '3001822585' overflowed an int column

非 Y 不嫁゛ 提交于 2019-12-05 10:16:04

Use unsignedInt datatype.

int range - 4 bytes, -2,147,483,648 to +2,147,483,647 
unsignedInt range - 0 to 4,294,967,295 

Your barcode value 3001822585 is exceeding max int value 2,147,483,647 and so throws error

Edit

unigned int are not found in SQL Server , however MySQL supports it. For SQL Server you will have to use bigINT

bigInt range - 8 bytes -2^63 to 2^63-1 

So change datattype of Barcode column to bigInt . If you think other column values can exceed int range , then change their datatype also.

SQl Statement:

SELECT max( Mother_ID)+1 FROM Mother

http://i.stack.imgur.com/ACKAW.jpg Msg 248, Level 16, State 1, Line 1 The conversion of the nvarchar value '182512900911500120' overflowed an int column.

The problem is caused due to the number 182512900911500120 exceeds int range. If we convert in to bigint than it works.

i.e.

SELECT max(convert(bigint,Mother_ID))+1 as MID FROM Mother

http://i.stack.imgur.com/ZLSNR.jpg Result 182512900911500121

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!