Question: I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it.

Ex: 

```
Declare @date datetime
Declare @time time

```

I want something like this

```
@date = @date + @time (but not concatenation)

SELECT @Startdate = DATEADD(DAY, -1, @date )

```

Is there any way?

Answer: 
You can tranform your time to seconds and add them to your datetime value:

```
DECLARE @datetime DATETIME = GETDATE(),
        @time TIME = '01:16:24',
        @timeinseconds INT

PRINT 'we add ' + CAST(@time AS VARCHAR(8)) + ' to ' + CONVERT(VARCHAR,@datetime,120)+ ':'

SELECT @timeinseconds = DATEPART(SECOND, @time)
                        + DATEPART(MINUTE, @time) * 60
                        + DATEPART(HOUR, @time) * 3600

SET @datetime = DATEADD(SECOND,@timeinseconds,@datetime)

PRINT 'The result is: ' + CONVERT(VARCHAR,@datetime,120)

```

Output:

```
we add 01:16:24 to 2015-07-17 09:58:45:
The result is: 2015-07-17 11:15:09

```
If you need to take only date part from `@date` and time part from `@time` - can convert your `@date` and `@time` to strings, concatenate the values and convert back to datetime:

```
select cast(convert(nvarchar(20), @date, 104) + ' ' +
            convert(nvarchar(20), @time, 108) as datetime2)

```

Or, alternatively, if you need to add time to datetime value, you can do something like:

```
select dateadd(ms, 
           datepart(ms, @time), 
           dateadd(ss, 
                   datepart(ss, @time), 
                   dateadd(mi, 
                           datepart(mi, @time), 
                           dateadd(hh, datepart(hh, @time), @date))))

```