Solved

Arithmetic overflow error

Posted on 2006-11-22
3
1,235 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now