MS SQL Server Division not returning Fractional Values


MSSQL Server Numeric Division always raise confusions

eg. suppose we are executing

select 100 / 3


not 33.333333

this is because division of int with another  int will be of data type int again

this is called implicit type casting , to acheive accurate results with fractional part change the above query with the following one

select cast (100 as float) / cast (3 as float)

Now Result will be 33.333333

the same thing can be do like this

select 100.00 / 3

Now Result will be again  33.333333

Here 100.00 will be treated as float with out explicitly type casting in to float, and there by float / int = float

Published by


a gadget and internet addict , a red hat certified linux administrator with skills in dataware development and online technologies., follow me on twitter @abhilashsnair