I am struggling with this. We want to pull everyone that is going to have a 5 year anniversary in 2014. We have a field of DateHired which is yyyy-mm-dd format. How do I pull everyone who was hired in 2009
We would like this to automatically update each year without having to go in and change the code.
where datehired like cast(year(getdate())-5 as char(4))+'%' /* this line if datehired is char type */
where year(datehired)=year(getdate())-5 /* this line if datehired is date/datetime type */