Arithmetic overflow error converting expression to data type smallint

Rajesh Kumar Yadav 1 Reputation point
2023-02-21T06:17:02.3933333+00:00

i am using sqlserver 2019

hi,

I have started getting this message, from a stored procedure, which is not repeating, it comes after now and then, or sometimes it does not come at all. (while testing: I kept stored procedure  and parameter same).

Msg 8115, Level 16, State 2, Procedure uspMS, Line 11 [Batch Start Line 0]
Arithmetic overflow error converting expression to data type smallint.
The statement has been terminated.
Msg 8115, Level 16, State 2, Procedure uspMS, Line 51 [Batch Start Line 0]
Arithmetic overflow error converting expression to data type smallint.
The statement has been terminated.
Msg 8115, Level 16, State 2, Procedure uspMS, Line 101 [Batch Start Line 0]
Arithmetic overflow error converting expression to data type smallint.
The statement has been terminated.
Msg 8115, Level 16, State 2, Procedure uspMS, Line 156 [Batch Start Line 0]
Arithmetic overflow error converting expression to data type smallint.
The statement has been terminated.
Msg 8115, Level 16, State 2, Procedure uspMS, Line 177 [Batch Start Line 0]
Arithmetic overflow error converting expression to data type smallint.
The statement has been terminated.

Completion time: 2023-02-19T16:54:41.9293756+05:30

 

INSERT INTO KKR (BridgID,Remarks,Status)
SELECT DISTINCT BridgID,Remarks,1
FROM
kkrMain where kkrmainid=23

when i update the stored procedure which has the above code , it starts running properly, and after sometimes it show it again. so i have decided to put "WITH RECOMPILE" to see if it works. but pls consider above question with out recompile

yours sincerly

 

SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-02-21T07:12:14.56+00:00

    Arithmetic overflow error converting expression to data type smallint.

    As the message says, you get the same with

    select convert(smallint, 100000)
    
    

    But without knowing your data and code it's impossible to say what it causes,


  2. Naomi Nosonovsky 8,431 Reputation points
    2023-02-22T14:21:26.3066667+00:00

    Double check triggers on your table and show the whole procedure code for investigation.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.