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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -