Click here to Skip to main content
15,885,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,

I m getting the below error while i m running a procedure

Error : Arithmetic overflow error converting expression to data type int.

Here is my query

SQL
DECLARE @COUNT INT, @INVOICENO VARCHAR(100)

SELECT @COUNT = isnull( MAX(CONVERT(BIGINT,replace ( substring(INVOICENO,0,case when charindex('-',INVOICENO,0)  > 0 then charindex('-',INVOICENO,0) else len (Invoiceno) + 1 end  ),' ', ''))),0) ,@EmployerId = MAX(SUPERVISORNAME) fROM TBL_NEW_TIMESHEET
WHERE CONTRACTORID = @CONTRACTORID AND INVOICENO IS NOT NULL


Thanks
Posted
Updated 17-Jan-13 16:33pm
v2
Comments
PIEBALDconsult 17-Jan-13 23:13pm    
See which values it fails for.
[no name] 18-Jan-13 0:01am    
why are you usiug INT with @Count while converting to BIGINT in the query??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900