dimanche 21 août 2016

How to named CSV file as yesterday' date?

I need a SQL job to run every day.

This CSV file needs to be named with yesterday’s date. So, if this job was to run today, it would generate a file called 20160820_invoices.csv.

I use following code but it's not work. "C:\Invoices_" + (DT_WSTR,4)DATEPART("yyyy",GetDate()) + RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + RIGHT("0" + (DT_WSTR,2)DATEADD("dd", -1, GetDate()),2) + ".csv"`

Is there any other way it can get work?

Aucun commentaire:

Enregistrer un commentaire