April 18, 2013 at 3:18 am
i am have a problem to get overtime hours
the table
EmployeeNo TimeIn TimeOut BreakHours WorkingHours
001 06:20 19:00 1 8
how query to get overtime hours
note : datatype Timein, timeout, BreakHours,WorkingHours is decimal(6,3)
OverTime = (Timein + timeout) - BreakHours - WorkingHours
April 18, 2013 at 3:22 am
sugiarttampubolon (4/18/2013)
i am have a problem to get overtime hoursthe table
EmployeeNo TimeIn TimeOut BreakHours WorkingHours
001 06:20 19:00 1 8
how query to get overtime hours
note : datatype Timein, timeout, BreakHours,WorkingHours is decimal(6,3)
OverTime = (Timein + timeout) - BreakHours - WorkingHours
Hello and welcome to SQL Server Central!
Could you supply sample data, DDL and expected results as per this article --> http://www.sqlservercentral.com/articles/Best+Practices/61537/ ?[/url] If you do, it really helps the unpaid volunteers of this website to help solve your issue or point you in the right direction.
Thanks.
April 18, 2013 at 3:27 am
Decimals are not a good data type to store time
You have given 06:20 and 19:00 as sample data which doesn't look like decimals
Are you sure the data type is decimal and not something else?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 18, 2013 at 5:56 am
i am sure the data is decimal(6,3)..
the detail is make a store procedure from 2 database
master_db and temporary_db but i cannot touch the source program just make stored procedure to transfer data
from temporary_db to master_db
table Overtimetransaction in temp_db
Emp_No OverTimeHours
001 2.5
tbl absent in master_db
Emp_No TimeIn TimeOut BreakHours TotalWorkingHours OverTimeHours
001 06:20 19:10 1 8
so when the data transfer i must make validation to read total from (timein + timeout - BreakHours - WorkingHoursperday)
in table absent in master_db, if same, overtimehours in temp_db transfer to tbl absent in master_db if not same not transfer
thanks...please help
April 18, 2013 at 6:07 am
sugiarttampubolon (4/18/2013)
i am have a problem to get overtime hoursthe table
EmployeeNo TimeIn TimeOut BreakHours WorkingHours
001 06:20 19:00 1 8
how query to get overtime hours
note : datatype Timein, timeout, BreakHours,WorkingHours is decimal(6,3)
OverTime = (Timein + timeout) - BreakHours - WorkingHours
The formula for overtime does not look right to me either.
April 18, 2013 at 6:20 am
sugiarttampubolon (4/18/2013)
i am sure the data is decimal(6,3)..the detail is make a store procedure from 2 database
master_db and temporary_db but i cannot touch the source program just make stored procedure to transfer data
from temporary_db to master_db
table Overtimetransaction in temp_db
Emp_No OverTimeHours
001 2.5
tbl absent in master_db
Emp_No TimeIn TimeOut BreakHours TotalWorkingHours OverTimeHours
001 06:20 19:10 1 8
so when the data transfer i must make validation to read total from (timein + timeout - BreakHours - WorkingHoursperday)
in table absent in master_db, if same, overtimehours in temp_db transfer to tbl absent in master_db if not same not transfer
thanks...please help
Can you provide us the DDL of your "tbl absent in master_db"?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 18, 2013 at 6:40 am
sugiarttampubolon (4/18/2013)
i am have a problem to get overtime hoursthe table
EmployeeNo TimeIn TimeOut BreakHours WorkingHours
001 06:20 19:00 1 8
how query to get overtime hours
note : datatype Timein, timeout, BreakHours,WorkingHours is decimal(6,3)
OverTime = (Timein + timeout) - BreakHours - WorkingHours
hi sugiarttampubolon,
you can't store 06:20 value in decimal datatype.
--chalam
April 18, 2013 at 6:49 am
batgirl (4/18/2013)
sugiarttampubolon (4/18/2013)
i am have a problem to get overtime hoursthe table
EmployeeNo TimeIn TimeOut BreakHours WorkingHours
001 06:20 19:00 1 8
how query to get overtime hours
note : datatype Timein, timeout, BreakHours,WorkingHours is decimal(6,3)
OverTime = (Timein + timeout) - BreakHours - WorkingHours
The formula for overtime does not look right to me either.
I would agree. TimeOut - TimeIn gives total hours at work. Subtract BreakTime gives total hours worked, Subtract WorkingHours leaves OvertimeHours.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply