Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

377 Posts

Posted - 12/28/2006 :  01:04:31  Show Profile  Reply with Quote
HI fys

Iam doing Earned Leave module..from jan to dec..totdays=150 (an employee worked)
EL days=for 20 days 1 day pay
(ie) totdays/20
150/20 =7.5 eldays to be paid to an employee
while dividing by 20 if the decimal place falls between .1 and .5 should be assigned to .5 and the result should be 7.5

while dividing by 20 if the decimal place falls > .5(for example 7.7,7.8 and so on) should be assigned to 1 and the result should be 8

can any one help???????

Constraint Violating Yak Guru

292 Posts

Posted - 12/28/2006 :  09:32:21  Show Profile  Reply with Quote
Check out the ROUND function....

DECLARE @num decimal(10,2)
DECLARE @den decimal(10,2)

SET @num = 150
SET @den = 20

SELECT @num / @den, Round(@num / @den, 0)
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 01/01/2007 :  02:57:46  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Round will work for decimal values>=0.5
If you want it for >0.5, then tell us why?
Otherwise try


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000