I am new to SQL Server, this question might be repeated here. Since i haven't find a solution for my problem. I wished to post here. So here is my problem
select(volume * speed) from traffic_data_replica;
I am trying to multiply values from two columns , data type is smallint for both columns. Error i got is :
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type smallint.
Cast one of the values to a "bigger" type before the calculation:
select cast(volume as int) * speed
from traffic_data_replica;
You can also do this easily by multiplying by 1.0:
select 1.0*volume*speed
from traffic_data_replica
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With