I'm having issues with Leap Year what can i do to change it to 28 feb or 1st march
i'm getting the below error,
Msg 289, Level 16, State 1, Line 21 Cannot construct data type date, some of the arguments have values which are not valid. enter code here
SELECT
cast(MEMNO as int) MEMNO,
cast(YEAR(EXITDATE) as int)
[StartYear],
case WHEN DATEFROMPARTS(cast(YEAR(GETDATE()) as int)+1,
DATEPART(m, EXITDATE), DATEPART(d, EXITDATE))<=GETDATE() THEN cast(YEAR(GETDATE()) as int) else cast(YEAR(GETDATE()) as int) END [EndYear]
FROM EXITRETIREMENT
group bY
cast(MEMNO as int),
cast(YEAR(EXITDATE) as int),
EXITDATE
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EXITRETIREMENT](
[MEMNO] [int] NULL,
[EXITDATE] [datetime] NULL
) ON [PRIMARY]
GO
INSERT [dbo].[EXITRETIREMENT] ([MEMNO], [EXITDATE]) VALUES (45517,CAST(N'2004-02-29T00:00:00.000' AS DateTime))
GO