We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Converting DatePart to String in Expression Builder

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?

1
Contributor
1
Reply
1 Hour
Discussion Span
4 Months Ago
Last Updated
3
Views
Question
Answered
Stuugie
Posting Whiz
366 posts since Jun 2012
Reputation Points: 30
Solved Threads: 4
Skill Endorsements: 0

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

Stuugie
Posting Whiz
366 posts since Jun 2012
Reputation Points: 30
Solved Threads: 4
Skill Endorsements: 0
Question Self-Answered as of 4 Months Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.3516 seconds using 2.65MB