Type Cast Error

Ali Ahad
131
Reputation points
I am trying to write a derived column expression to check for year. We get a data file for employees for previous month in the current month and I am trying to tackle the year so when I get the file in January the year should be 2024 since I will get the data for December, but I am getting conversion error:
my expression code
(DT_WSTR, 4) MONTH( GETDATE() ) == 1 ?
DATEADD("YEAR",-1,GETDATE()) :
DATEADD("YEAR",0 ,GETDATE())
Any help is appreciated.
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,681 questions
Sign in to answer