1,105,585 Community Members

Converting DatePart to String in Expression Builder

Member Avatar
Stuugie
Posting Shark
925 posts since Jun 2012
Reputation Points: 39 [?]
Q&As Helped to Solve: 40 [?]
Skill Endorsements: 4 [?]
 
0
 

Hi all,

I am attempting to rename a file using the File System Task Editor in SSIS. In the Expression Builder, I have

@[User::fileName]+(DT_WSTR,2)DATEPART("mm",GETDATE())+(DT_WSTR,4)DATEPART("yyyy",GETDATE())+".zip"

but it returns the following error:

TITLE: Expression Builder

Expression cannot be evaluated.

ADDITIONAL INFORMATION:

The data types "DT_I4" and "DT_WSTR" are incompatible for binary operator "+". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator.

Attempt to set the result type of binary operation "@[User::fileName] + (DT_WSTR,2)DATEPART("mm",GETDATE())" failed with error code 0xC0047080.

Can someone please tell me what I am doing wrong?

Member Avatar
Stuugie
Posting Shark
925 posts since Jun 2012
Reputation Points: 39 [?]
Q&As Helped to Solve: 40 [?]
Skill Endorsements: 4 [?]
 
0
 

I took a completely different approach to this and am using Package Variables within the File System Task Editor.

Question Self-Answered as of 1 Year Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article