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.
Author |
Topic |
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2006-12-28 : 01:04:31
|
HI fysIam doing Earned Leave module..from jan to dec..totdays=150 (an employee worked)EL days=for 20 days 1 day pay (ie) totdays/20150/20 =7.5 eldays to be paid to an employeewhile dividing by 20 if the decimal place falls between .1 and .5 should be assigned to .5 and the result should be 7.5while 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 8can any one help??????? |
|
JoeNak
Constraint Violating Yak Guru
292 Posts |
Posted - 2006-12-28 : 09:32:21
|
Check out the ROUND function....DECLARE @num decimal(10,2)DECLARE @den decimal(10,2)SET @num = 150SET @den = 20SELECT @num / @den, Round(@num / @den, 0) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-01-01 : 02:57:46
|
Round will work for decimal values>=0.5If you want it for >0.5, then tell us why?Otherwise tryRound(number-0.1,0)MadhivananFailing to plan is Planning to fail |
|
|
|
|
|