Solved

Arithmetic overflow error

Posted on 2006-11-22
3
1,247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

627 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