Question: How to compare two dates in a SQL Server database with `between` statement and remove time from it's value? 

This is my code:

```
select 
    sum(TbDeals.dealPrice) as sumofvalues 
from 
    DNN_TbDeals
where 
    Deals.dealStartDate between Convert(Date, Convert(datetime, '2017-07-10 22:21:16.233')) 
                            and Convert(Date, Convert(datetime, '2017-07-10 22:21:16.233'))

```

Answer: 
Assuming `Deals.dealStartDate` is a `DateTime` column, you don't have to convert twice - If you want to do a `between` 2 dates, convert it once with a fixed format, this way you don't have to remove the time string.

Also - in your question, you posted a `between` with the **exact same dates**. This is probably the reason you are getting no results.

Please try the following:

```
select sum(TbDeals.dealPrice) as sumofvalues 
from DNN_TbDeals
where 
    Deals.dealStartDate
    between 
        Convert(datetime, '2016-01-01 22:21:16.233', 101)
    and 
        Convert(datetime, '2017-08-28 22:21:16.233', 101)

```
```
select sum function column,CONVERT(nvarchar,DateColumnName,101) DateColumnName  
from tableName where DateColumnName between '08/28/2017' and '08/30/2017'

```