Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Arithmetic - Checking For 0

Author  Topic 

Scott Scriver
Starting Member

4 Posts

Posted - 2001-01-14 : 08:52:42
I have the following SQL Statement:

SELECT Value1, Value2,
CONVERT(decimal(3,3),CAST(Value1 AS decimal(5,2)) / CAST(Value2 + Value1 AS decimal(5,2))) as Value3
FROM tbTable

If either Value1 or Value2 are 0 then I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e57'

[Microsoft][ODBC SQL Server Driver][SQL Server]Arithmetic overflow error converting numeric to data type numeric

If Value1 is 0 then I want Value3 to be 0.00. If Value2 is 0, then I want Value3 to be 100.00.

Both Value1 and Value2 are int.

This is on SQL7 w/SP3

Thanks in advance for your help!

Scott
   

- Advertisement -