"将表达式转换为数据类型int的算术溢出错误"

1 人关注

我试图执行我的简单SQL代码来创建一个表。

BEGIN TRANSACTION;
CREATE TABLE vlan (vlanId int, vlanValue varchar(250), vlanName varchar(250), portId int, portName varchar(250), nodeId int, nodeName varchar(250));
INSERT INTO vlan VALUES(1111,998,'VOICE',7272,'1/97',456439345,'10.2.2.2');
INSERT INTO vlan VALUES(923482342,240,'INFODESK',2348328434,'4/46',2349234234,'10.1.2.3');
COMMIT;

它给出了错误。

Msg 8115, Level 16, State 2, Line 16164
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
Msg 8115, Level 16, State 2, Line 16165
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
Msg 8115, Level 16, State 2, Line 16166
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.

该表有大约16500个元素。是不是因为文件太大?

任何帮助都将是有用的。

sql
types
sql-server-2008
dorsalfin
dorsalfin
发布于 2011-07-18
2 个回答
Jacob
Jacob
发布于 2020-06-20
已采纳
0 人赞同

你的vlanId列对于数据类型来说太大了 int (-2147483647到2147483647)。 使用 bigInt .

链接到 SQL Server文档。

Oded
Oded
发布于 2020-06-20
0 人赞同