sql server - SQL Statement DATEPART Help -
what wrong sql statement? keep getting selmonth , curmonth invalid columns, doing clause wrong? datepart causing problem here?
select top (5) ename, edate, edateend, datepart(month, edate) selmonth, datepart(month, { fn curdate() }) curmonth events (edate >= { fn curdate() }) , (selmonth = curmonth)
thanks
you can't use selmonth , curmonth in clause:
select top (5) ename, edate, edateend, datepart(month, edate) selmonth, datepart(month, { fn curdate() }) curmonth events (edate >= { fn curdate() }) , (datepart(month, edate) = datepart(month, { fn curdate() }))
Comments
Post a Comment