How to write SSIS expression to append Previous week Monday to filename -
i trying rename file appending previous monday date filename.i using following expression appending today's date
@[dest_dir] + "\\" + @[dest_file] + "_" + (dt_wstr,4)datepart("yyyy", getdate()) + right("0" + (dt_wstr,2)datepart("mm", getdate()), 2) + right("0" + (dt_wstr,2)datepart("dd", getdate()), 2) + ".xlsx"
which working fine when replacing getdate() getdate()-7 last monday date(i run every monday) getting error. can me expression previous monday.
try this:
@[dest_dir] + "\\" + @[dest_file] + "_"+ (dt_wstr,4) year(dateadd( "dd", -7, getdate()))+ right( "0" + (dt_wstr,2) month( dateadd( "dd", -7, getdate() ) ), 2) +right( "0" + (dt_wstr,2) day( dateadd( "dd", -7, getdate() ) ), 2) + ".xlsx"
the returned format is:
dest_dir\dest_file_20160718.xlsx
removing 7 days getdate() using dateadd
Comments
Post a Comment