Home Forums SQL Server 2016 SQL Server 2016 - Development and T-SQL convert year to last date of the year RE: convert year to last date of the year
Ed Wagner
SSC Guru
Points: 287024
More actions
May 26, 2017 at 5:51 pm
#1944401
Jason A. Long - Friday, May 26, 2017 1:20 PMBeing that the last day of every year is 12/31, why not just use DATEFROMPARTS...DECLARE @Year INT = 2017;SELECT LastDayOfYear = DATEFROMPARTS(@Year, 12, 31);
DECLARE @Year INT = 2017;SELECT LastDayOfYear = DATEFROMPARTS(@Year, 12, 31);
Now that's the easy way. 😉
Tally Tables - Performance PersonifiedString Splitting with True PerformanceBest practices on how to ask questions