Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

Float problem in SQL Server

Hi,

Why does this statement return 0 instead of 0.5?

SELECT
  (1/2)

Thanks!
0
krimsonius
Asked:
krimsonius
  • 2
1 Solution
 
imran_fastCommented:
select (1.0/2.0)
0
 
imran_fastCommented:
Because the sql compiler treats it as an integer.
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now