sql-server - 将表达式转换为数据类型 int 的算术溢出错误,即使它是 BigInt
问题描述
我试图在表中插入一行,这会引发算术溢出错误。但是,我很难理解原因!
Here's the table Columns-
[id] [int] IDENTITY(1,1) NOT NULL,
[batch_number] [bigint] NOT NULL,
[mixer_batch_history_id] [int] NULL,
[lab_test_type_id] [int] NOT NULL,
[lab_test_compound_id] [int] NOT NULL,
[machine_number] [int] NULL,
[sample_location_id] [int] NULL,
[sample_date] [datetime] NOT NULL,
[pass_customer_specs] [int] NOT NULL,
[pass_internal_specs] [int] NOT NULL,
[tested_by] [nvarchar](25) NULL,
[last_test] [bit] NULL,
[date_created] [datetime] NOT NULL
我正在尝试以下查询 -
DECLARE @batchNo as BIGINT = 2010000976009
INSERT INTO [LoMOS].dbo.lab_test
(batch_number, mixer_batch_history_id, lab_test_type_id, lab_test_compound_id, machine_number, sample_location_id, sample_date, pass_customer_specs, pass_internal_specs, date_created)
VALUES (@batchNo, 16579, 1, 128, 1, 1, '2020-07-06 08:43:25.227', 0, 1, '2020-07-08 07:44:27.993')
SELECT SCOPE_IDENTITY()
哪个引发错误 -
Arithmetic overflow error converting expression to data type int.
Msg 3609, Level 16, State 1, Line 3
任何想法 ?
解决方案
根据提供的信息,错误似乎很可能来自触发器,而不是发布的插入。
推荐阅读
- javascript - 如何从应用程序/八位字节流数据创建文件?
- netlogo - 将海龟移动到具有 xy 坐标的特定补丁 netlogo
- javascript - 使用 HTML 和 CSS 的导航栏中的子菜单大小
- python - Python opencv imwrite 不会将图像保存到目的地
- text - 如何使用 EGL 显示一些文本
- database - 为什么复制数据库的压力较小?
- php - 上传图片它不工作codeigniter
- c# - Angular 5 Uncaught(承诺):错误:StaticInjectorError(AppModule)
- reactjs - 如果单选按钮和文本输入均为空白,则禁用提交按钮
- laravel - 如何将 Composer 配置为始终下载最新版本?