“将表达式转换为数据类型 int 时出现算术溢出错误" [英] "Arithmetic overflow error converting expression to data type int"

查看:37
本文介绍了“将表达式转换为数据类型 int 时出现算术溢出错误"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行我的简单 SQL 代码来创建一个表.

I'm trying to execute my simple SQL code to create a table.

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 个元素.是不是文件太大了?

The table has approx. 16500 elements. Is it because the file is too large?

任何帮助都会有用.

推荐答案

对于数据类型 int(-2147483647 到 2147483647).使用 bigInt.

Your vlanId column is to big for the datatype int (-2147483647 to 2147483647). Use bigInt.

链接到 SQL Server 文档

这篇关于“将表达式转换为数据类型 int 时出现算术溢出错误"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆