Show decimal value

  • Hi,

    When I run the following sql statement on management studio sql server 2008 r2, I get a result of 41123

    Select (((1343898461-(6*3600))/86400)+25569)

    If I run this same query in oracle

    Select (((1343898461-(6*3600))/86400)+25569) from dual

    I get the result of 41123.130335648148148148148148148148148

    How do I get sql server to show this in decimal places as per oracle.

  • All the numbers you have given SQL are whole numbers, so SQL will only return a whole number.

    If you want the decimal point, you will need to change a value to have .0 at the end of it.

    Like this

    Select (((1343898461.0-(6*3600))/86400)+25569)

    Which gives this result

    41123.1303356

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply