I've been using the following C#/SQL combo to get a solution. It works as-is but I would like to have a pure-SQL solution if possible.
[C#/SQL Combo]
string strCurrentTimeOnly = DateTime.Now.ToShortTimeSt
ring(); // 10:17 AM
string strDayofWeek = DateTime.Now.DayOfWeek.ToS
tring(); // Thursday
string sql = " Select * from tbl_Users where col3 = 'True' " +
" and DateDiff(n, col_TimeOnly, '" + strCurrentTimeOnly + "') between 1 and 1 " +
" Or col_DayOfWeek = '" + strDayOfWeek + "')";
[SQL using GetDate()]
" Select * from tbl_Users where col3 = 'True' " +
" and DateDiff(minute, col_TimeOnly, GetDate()) between 1 and 1 " +
" Or col_DayOfWeek = '" + strDayOfWeek + "')";
The SQL above returns nothing... I think the problem is GetDate() represents datetime and not just time only ....
Help...
Start Free Trial