Cant Dateformat for CSV files (Data lake store to Data lake Analytics / Data Store ) using USQL


  • Hello everyone,

    i have csv files with date datatype columns in azure data lake store, i am trying to do more transformation using USQL code, While dealing with date column i am getting error. 

    Source file : sample.csv

    outputfile : opsample.csv

    Expected ouput: without touching source file, i have to read all the columns and commonly have to derive mm-dd-yy format in the output file interms of source date column can be mon-dd-yy / mm-dd-yyyy 

    sample code attached for reference. 

    DECLARE @dir string = "/BCBSvermot/DataSource/Sample.csv";
    DECLARE @file_set_path string = "/BCBSvermot/Sample_output.csv";
    @data =
    EXTRACT Date string
    FROM @dir
    USING Extractors.Csv(skipFirstNRows:1);
    @result =
    string.IsNullOrEmpty([Date]) ? null : DateTime.ParseExact(Date, "yyyy-MMM-dd HH:mm:ss:fff EST", null).ToString("MM/dd/yyyy HH:mm:ss") AS Date
    FROM @data;
    OUTPUT @result
    TO @file_set_path

    USING Outputters.Csv();

    Thanks in advance.


    Friday, May 17, 2019 5:02 AM

All replies