I have seen many examples on the internet regarding similar issues, but nothing quite what I am trying to achieve.
My Scenario
I have a table which stores an EndTime in minutes (1050) meaning 17:30:00
I have written a query to update a column in a referenced table when its null, however the date itself is set to 1900-01-01 17:30:00.000. And no matter what I try, I only get the date correct or time correct... heres the query that converts the int to time and displays the incorrect date above:
UPDATE t
SET t.EndTime = (
SELECT CONVERT (datetime, DATEADD(MINUTE, EndTime, '00:00:00'), 108)
FROM Staff
WHERE
StaffID = t.StaffID
)
FROM TimesheetLine t
WHERE t.EndTime IS NULL
I am trying to achieve 2015-01-07 17:30:00.000
Staff.EndTime is where the 1050 minutes are stored
TimesheetLine.EndTime is the field I am trying to set to 2015-01-07 17:30:00.000 when it is null
thankyou for your help and apologies if there is a duplicate question...