Viewing 15 posts - 1 through 15 (of 26 total)
Thanks a ton Scott...
Missed pasting the complete code...
Below is the complete code
update Attendance
set workedhours =
--convert(decimal(10,2),REPLACE(CONVERT(char(5),es_sign_out - es_sign_in,8),':','.'))
convert(decimal(10,2),(rtrim(convert(char(5),datediff(ss,sign_in,sign_out) / 3600 )) + '.' +
rtrim(convert(char(5),(datediff(ss,sign_in,sign_out) % 3600) / 60)) ))
The answer...
July 16, 2009 at 4:04 am
Thanks Scott 🙂
a composite decimal value whose whole part represents hours and whose fractional part represents minutes / 100?
This is what i'm looking for...my query which I posted...
July 15, 2009 at 9:24 am
Tried this query
--begin tran
--update Attendance
--set workedhours = convert(decimal(10,2),REPLACE(CONVERT(char(5),sign_out - sign_in,8),':','.'))
--where attendancedate = '04/03/09'
--commit tran
Can someone validate and tell me whether I'm wrong, SSHR took a leaf from your query.
July 15, 2009 at 8:33 am
Scott Coleman (7/15/2009)
DECLARE @In DATETIME, @Out DATETIME, @Span DATETIME
SET @In = '2009-07-13 7:53:00 AM'
SET @Out = '2009-07-13 4:04:45 PM'
-- Full hours and minutes (no rounding)
SET @Span = @Out - @In
PRINT...
July 15, 2009 at 8:21 am
Hi SSCrazy,
select
CAST(CAST(sign_out - sign_in AS FLOAT) * 24 AS dec(10,2)) wrkdhrs
from Attendance
where es_attendancedate = '04/03/09'
gives an o/p at 11.72 which should be 12.12 hrs.
Wud try implementing the other choices...
July 15, 2009 at 8:09 am
To make things for better understanding, find below the table structure which I have created....
CREATE TABLE [dbo].[Attendance_Summary](
[EmployeeNo] [int] NULL,
[AttendanceDate] [datetime] NULL,
[Sign_In] [datetime] NULL,
[Sign_Out] [datetime] NULL,
[WorkedHours] [decimal](10, 2) NULL,
) ON [PRIMARY]
The...
July 15, 2009 at 6:30 am
Thanks Alan! The reason for multiple ldf's was done by previous DBA, who created multiple ldf when complained of log getting filled.
Atleast to make life easier henceforth, thought to set...
June 9, 2008 at 11:22 pm
Thanks Ganesh & Sergiy, thought of a workaround, so that i passed the date too as a parameter, but until today never knew that UDF cannot house getdate().
One thing learnt...
April 23, 2007 at 4:35 am
I was using the begin tran for a select statement rather than the update statement, but fought tough to spot it out. Modified...and used it at the right portion and...
February 1, 2006 at 7:43 am
oh buddy Bob, forgot to tell u that tried that first, still getting the same error message...
Arun
January 23, 2006 at 3:40 am
Gila,
We are capturing day by day hours and not the total hours hence is the columns repeating for everyday...do let me know if i'm right.
Arun
October 27, 2005 at 2:21 am
and u r right graham, i missed out the rs.movenext. I have done that and it worked.
Thanks again.
August 18, 2005 at 3:27 am
Hit on the bull's eye, that is what is wanted...
Chris, just started working on sql and when would i provide solution for others like this.
3 Cheers
Arun
August 3, 2005 at 2:55 am
That worked, but didn't work for the pubs.authors and it worked when i created a table of my own (testing with 2 fields).
Thanks all hope i stop my doubts for 2day...catch...
July 14, 2005 at 6:07 am
Thanks a ton Ray, the first one worked like a bub.
But i faltered in trying the second option...created the table sales_copy (copy of sales in pubs database)
here is the sql...
July 14, 2005 at 5:02 am
Viewing 15 posts - 1 through 15 (of 26 total)