Solved

Arithmetic overflow error

Posted on 2006-11-22
3
1,237 Views
Last Modified: 2008-02-01
For the 2 stored procedures I am getting the same error in different lines with similar condition.
 
In storedprocedure1   I am getting the   SET @Flag1 = @Flag1 + 1  where it is DECLARE @Flag1 TINYINT

Server: Msg 220, Level 16, State 2, Procedure uspBatchClientHierarchy, Line 100
Arithmetic overflow error for data type tinyint, value = 256.



In storedprocedure2  I am getting the   SET @Flag2 = @Flag2 + 1  where it is DECLARE @Flag2 SMALLINT

Server: Msg 220, Level 16, State 2, Procedure uspBatchClientHierarchy, Line 150
Arithmetic overflow error for data type tinyint, value =  32768
0
Comment
Question by:Richards
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17994040
Hi Richards,


change the datatype of @flag1 to int , tiny int can store upto 255



Cheers!
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 125 total points
ID: 17994042
also do the same with @flag2 , change it as int
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17995545
try print @flag1,@flag2
to check what is the value it reached at the time of error. may be you need to initialize the value
set @flag1 = 0
after some iteration

other wise as aneesh suggested change datatype to int
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question