Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Expression cannot be evaluated

$
0
0

I am executing queries against a large SQL db and getting the data I want. But I want to send the data to a file, which I also have working BUT I can't get an expression to work for naming the file. The data is for the previous month so I want a name like (today is 08/14/2016):

Source201607XX.txt

I have tried at least 20 different expressions like:

"Source" + (DT_STR, 4, 1252)DATEPART("yyyy", GETDATE()) +  RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm" , DATEADD("mm",-1,GETDATE())) + "XX.txt"

and get

Expression cannot be evaluated.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2008&ProdVer=9.0.30729.1&EvtSrc=Microsoft.DataTransformationServices.Controls.TaskUIFramework.TaskUIFrameworkSR&EvtID=FailToEvaluateExpression&LinkId=20476

Attempt to parse the expression ""Source" + (DT_STR, 4, 1252)  DATEPART("yyyy" , GETDATE()) +  RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm" , DATEADD("mm",-1,GETDATE())) + "XX.txt"" failed. The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.

 (Microsoft.DataTransformationServices.Controls)

If I do:

"Source" + (DT_STR, 4, 1252)DATEPART("yyyy", GETDATE()) +  RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm",GETDATE()) + "XX.txt"

It works fine.

Any help would be greatly appreciated.

Thanks,

JoeB


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>