Hi guys,
I have an SQL database with a trigger to fill in some extra data from other tables when a record is inserted. One task is to add a time (in minutes) to a DATETIME field.
Here is a extract:
DECLARE
@varTimeAdjustment DATETIME
SELECT
@varTimeAdjustment = (select LogTime from INSERTED) + 1/1440 * (Select ResponseTime from ProblemCodes where Ref = (select ProblemRef from INSERTED))
Now, the ResponseTime query comes back as 15 [minutes]. If i have it just LogTime + Response time it adds 15 days (close!) so Im trying to use 1/1440 as that is 1/mins in a day.
However, when i put the 1/1440 in, i have tried several different ways, it records exactly the same time, as if it was adding 0!
This is driving me crazy! Please help almighty sql gods.
I have an SQL database with a trigger to fill in some extra data from other tables when a record is inserted. One task is to add a time (in minutes) to a DATETIME field.
Here is a extract:
DECLARE
@varTimeAdjustment DATETIME
SELECT
@varTimeAdjustment = (select LogTime from INSERTED) + 1/1440 * (Select ResponseTime from ProblemCodes where Ref = (select ProblemRef from INSERTED))
Now, the ResponseTime query comes back as 15 [minutes]. If i have it just LogTime + Response time it adds 15 days (close!) so Im trying to use 1/1440 as that is 1/mins in a day.
However, when i put the 1/1440 in, i have tried several different ways, it records exactly the same time, as if it was adding 0!
This is driving me crazy! Please help almighty sql gods.