Hi,
I am trying to add two columns from table SHIFT. Column DURATION(INT) to COLUMN STARTTIME(datetime) and then put the result in a variable.
1. Convert DURATION to hours;
SELECT CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM Shift
2. Add results into variable, not sure how to do this. I have tried the following;
DECLARE @CalcDuration DateTime
SELECT @CalcDuration=
(SELECT CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM Shift
)
------------------------------------------------
DECLARE @CalcDuration DateTime
SET @CalcDuration = CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM SHIFT
Thanks for any help
I am trying to add two columns from table SHIFT. Column DURATION(INT) to COLUMN STARTTIME(datetime) and then put the result in a variable.
1. Convert DURATION to hours;
SELECT CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM Shift
2. Add results into variable, not sure how to do this. I have tried the following;
DECLARE @CalcDuration DateTime
SELECT @CalcDuration=
(SELECT CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM Shift
)
------------------------------------------------
DECLARE @CalcDuration DateTime
SET @CalcDuration = CONVERT(varchar, DATEADD(SS,Duration, 0), 114)+ StartTime
FROM SHIFT
Thanks for any help