I have a table named RETAILTRANSACTIONTABLE which has a column named BUSINESSDATE which has date in format(yyyy-mm-dd) 2015-05-22.
I want to comapre this date with batch.StartDateTime of format (dd-mm-yyyy hh:mm:ss) 05-10-2015 12:09:03.
var dateAndTime = batch.StartDateTime;
var date = dateAndTime.ToShortDateString();
string query = "SELECT COUNT(discamount) AS DISCOUNTCOUNT "+
" FROM ax.RETAILTRANSACTIONTABLE where "+
"(CONVERT(VARCHAR(10),BUSINESSDATE,105) >= '" + date
+ "') and DISCAMOUNT > 0
Using the above query gives me all the values of the column I just want the count of values greater than or equal to batch date