Get all dates from current year in SQL SERVER

Get all the date of current year or particular year, below is the scrip to get the record from sql server.
  1. Declare @Year AS INT = DATENAME(  
  2. YYYY,  
  3. getdate()  
  4. );  
  5. declare @FromDate datetime = DATEADD(yyyy, @Year -1900, 0),  
  6. @ToDate datetime = DATEADD(yyyy, @Year -1900 + 1, -1);  
  7. WITH Dates (DateNo) AS (  
  8. SELECT  
  9. DATEADD(  
  10. DAY,  
  11. DATEDIFF(DAY, 0, @ToDate) - DATEDIFF(DAY, @FromDate, @ToDate),  
  12. 0  
  13. )  
  14. UNION ALL  
  15. SELECT  
  16. DATEADD(DAY, 1, DateNo)  
  17. FROM  
  18. Dates  
  19. WHERE  
  20. DATEADD(DAY, 1, DateNo) <= @ToDate  
  21. )   
  22. SELECT   
  23.   DateNo as [Date],   
  24.   DATENAME(month, DateNo) as [Month Name],   
  25.   DATENAME(DW, DateNo) as [Day Name]   
  26. FROM   
  27.  Dates  
  28. option (maxrecursion 365);