I have a table with InsertedDate column which data type is 'Date'.
This column has today's date stored as '2017-07-12'.
Now I am trying to count the from this table based on today's date,
my query is :
SELECT Count(ProductSold) from ProductSalesDetail WHERE(DATEPART(yy, 'InsertedDate') = 2017 AND DATEPART(mm, 'InsertedDate') = 07 AND DATEPART(dd, 'InsertedDate') = 12)
It throws error : Conversion failed when converting date and/or time from character string.
how do i perform this operation ?