Saturday, 20 July 2013

display all the employees whose hiredate is not the first day of the month or the last day of the month

 select empid  from emp
 where datepart(dd,GETDATE()) != 1
 and datepart(dd,getdate()) !=
  DATEADD(dd,-day(dateadd(mm,1,getdate())), dateadd(mm,1,getdate()))


 select  DATEADD(dd,-day(dateadd(mm,1,getdate())), dateadd(mm,1,getdate()))

select  dateadd(mm,1,getdate())

No comments:

Post a Comment