Sql算术溢出
Sql arithmetic overflow
我有这个查询:
Insert into Course(name,age,id,facebookuser)
Values('Example',25,204813,blalbla@walla.com),
('Exmnumtwo',35,504813,email@walla.com)
这给我错误 8115:"arithmetic overflow error converting expression to data type int"。
但是,当我删除“,”符号时,一切正常,没有任何错误。是什么导致了错误?
基于你发给我的 png http://up415.siz.co.il/up3/tm3jjmurzzmx.png
您需要确保您的 ID 适合数据大小。您的实际数据会溢出 32 位有符号整数,因此您需要将您的 ID 类型设置为 64 位(或 32 位无符号)或选择具有较小数字的 ID,如您上面的示例,但由于您没有引用电子邮件地址而失败。
您的 Course
table 的 id
字段可能设置为 smallint
,最大值为 32,767。
将id
字段的数据类型设置为int
,将最大值增加到2,147,483,647。
SQL 服务器中的整数数据类型列表:https://msdn.microsoft.com/en-AU/library/ms187745.aspx
我有这个查询:
Insert into Course(name,age,id,facebookuser)
Values('Example',25,204813,blalbla@walla.com),
('Exmnumtwo',35,504813,email@walla.com)
这给我错误 8115:"arithmetic overflow error converting expression to data type int"。
但是,当我删除“,”符号时,一切正常,没有任何错误。是什么导致了错误?
基于你发给我的 png http://up415.siz.co.il/up3/tm3jjmurzzmx.png
您需要确保您的 ID 适合数据大小。您的实际数据会溢出 32 位有符号整数,因此您需要将您的 ID 类型设置为 64 位(或 32 位无符号)或选择具有较小数字的 ID,如您上面的示例,但由于您没有引用电子邮件地址而失败。
您的 Course
table 的 id
字段可能设置为 smallint
,最大值为 32,767。
将id
字段的数据类型设置为int
,将最大值增加到2,147,483,647。
SQL 服务器中的整数数据类型列表:https://msdn.microsoft.com/en-AU/library/ms187745.aspx