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: 
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))))

```
I'm not sure what's going on here, but if your variables are datetime and time types, this should work just fine:

```
declare @date datetime
declare @time time

set @date = '20150717'
set @time = '12:34:56'

set @date = @date + @time

select @date, DATEADD(DAY,-1,@date)

```

See [SQL Fiddle](http://sqlfiddle.com/#!3/9eecb7/1978)

If the problem is that @date contains also time part, you can use:

```
set @date = convert(datetime, convert(date, @date)) + @time

```