Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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;

it gives the error :

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.

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

any help will be useful. thank you

Yusuf

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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

Link to SQL Server Doc.

share|improve this answer
    
bigint worked thank you –  dorsalfin Jul 18 '11 at 10:20

From MSDN - int, bigint, smallint, and tinyint (Transact-SQL):

int

Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is integer.

The value you are trying to insert (2348328434) is outside of these. Use bigint instead.

share|improve this answer
    
bigint worked thank you –  dorsalfin Jul 18 '11 at 10:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.