SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

sent_sara
Constraint Violating Yak Guru

India
365 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???????

JoeNak
Constraint Violating Yak Guru

USA
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

madhivanan
Premature Yak Congratulator

India
22713 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
Round(number-0.1,0)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000