Domanda

I am dynamically generating the date for ssis tranformation using variable expression. My below expression generates the output like:

02102014.csv
Expression :
+RIGHT("0" + (DT_WSTR, 2)  MONTH(dateadd("d", -1, getdate())), 2) 
+RIGHT("0" + (DT_WSTR, 2) DAY(dateadd("d", -1, getdate())), 2)
+(DT_WSTR, 4)  YEAR(dateadd("d", -1, getdate()))+ ".csv"

How can I get the value like 021014.csv. In the year string it should pick up only last two values. Can anyone help me?

È stato utile?

Soluzione

Expression:

RIGHT("0" + (DT_WSTR, 2) MONTH(dateadd("d", -1, getdate())), 2) 
+ RIGHT("0" + (DT_WSTR, 2) DAY(dateadd("d", -1, getdate())), 2)
+ RIGHT((DT_WSTR, 4) YEAR(dateadd("d", -1, getdate())), 2)+ ".csv"

Result:

021014.csv

Altri suggerimenti

RIGHT("0" + (DT_WSTR, 2)  MONTH(dateadd("d", -1, getdate())), 2) 
+RIGHT("0" + (DT_WSTR, 2) DAY(dateadd("d", -3, getdate())), 2)
+RIGHT("1"+(DT_WSTR, 4)  YEAR(dateadd("d", -1, getdate())),2)+ ".csv"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top