Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Arithmetic overflow error

Posted on 2006-11-22
3
Medium Priority
?
1,255 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 500 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

886 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