You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行INSERT查询时出现Arithmetic overflow error错误的解决方法求助

解决办法

错误原因

你插入的手机号9984537856超出了SQL Server中int类型的最大值(2147483647)。即使目标字段mobile是bigint,直接输入该数值时,SQL Server会默认将其识别为int类型,进而触发算术溢出错误。

可行解决方案

  • 显式转换为bigint类型

    INSERT INTO SignUpForm (name, mobile, mail, password)
    VALUES ('Torito', CAST(9984537856 AS bigint), 'toritom@gmail.com', 'Torito@123')
    
  • 使用L后缀强制指定为bigint

    INSERT INTO SignUpForm (name, mobile, mail, password)
    VALUES ('Torito', 9984537856L, 'toritom@gmail.com', 'Torito@123')
    
  • 以字符串形式传入(依赖隐式转换)

    INSERT INTO SignUpForm (name, mobile, mail, password)
    VALUES ('Torito', '9984537856', 'toritom@gmail.com', 'Torito@123')
    

额外建议

插入数据时尽量显式指定字段列表,避免后续表结构变更引发字段顺序不匹配的问题。

内容的提问来源于stack exchange,提问作者Arinjay Malagave

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 09:07:39