I want to write a t-sql query which will simply list all of the years from 2005 to present. But i want this automated so this list will still be current next year. I know I could just hard code years with union. But how do I develop a t-sql query which will automate this?
Share
You can do this using Common Table Expressions (CTEs) and it doesn’t require you to create a temporary table: