Data Conversion in VS SSIS 2022

Dustin Weaver 20 Reputation points


I have a question related to data conversions in VS SSIS.

I am trying to create a variable that returns a yyyymmdd value. This is working in VS SSIS 2016:

RIGHT((DT_WSTR, 4) DATEPART("yyyy", DATEADD("dd", 1, GETDATE())), 4) +

RIGHT("0" + (DT_WSTR,2)DatePart("mm", DATEADD("dd", 1, GETDATE())), 2) +

RIGHT("0" + (DT_WSTR,2)DatePart("dd", DATEADD("dd", 1, GETDATE())), 2)

The evaluated value should equal 20231104.

I recieve an error stating "Cannot covert 'System.String' to 'System.Int32'.

Thank you for any help!!ExpressionBuilderErrorSSIS1

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,487 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jingyang Li 5,891 Reputation points

    Please check your variable Data Type (not the default Int32) to String.

    Before you use your custom code in the Expression section.

    I was wondering with the error message for too long as well.

0 additional answers

Sort by: Most helpful