Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I'm stuck on a really basic query and could use some help. I'm going to feel stupid when I see the answer.UPDATE Products SET Products.ReorderLevel = ROUND((2*(Suppliers.LeadTime /22))*Products.Trend,2)FROM Products INNER JOIN Suppliers ON Products.SupplierID = Suppliers.SupplierID ReorderLevel, LeadTime, and Trend are all INTThis ALWAYS returns 0 for the ReorderLevel but that's not accurate. For example, if the Trend is 20 and the lead time is 6 it updates ReorderLevel to zero but it should be 11.
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2010-06-10 : 16:25:13
You are doing integer math instead of decimal math (see difference below).You should read about both in SQL Server Books Online.