Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert YYYYMMDD to DD/MM/YYYY - Self-learning Qlikview Newbie

Hi           

I am trying to load data from SQL server using a OLE DB connection and would like to convert the data in the columns suffixed with the word Date (in Bold) from YYYYMMDD to DD/MM/YYYY format. Please Help.

The script I am using to load the data is:

SQL SELECT AccountingYearMonth as AccountingPeriod,

    AdmiDate AS StartDate,

    Age,

    SpellDisDate AS DischargeDate,

SpellDominantProcedure AS DominantProcedureSpell,

    SpellLoS AS LoS,

FROM SLAM.dbo."1415SLAMTAS";

Please reply with an amendment to the script

many thanks

3 Replies
swuehl
MVP

If QV interpretes the dates correctly, you just need to format in a preceding LOAD (or use formatting options of your source DBMS in the SQL part):

LOAD

     AccountingPeriod,

    Date(StartDate, 'DD/MM/YYYY') AS StartDate,

    Age,

    Date(DischargeDate,'DD/MM/YYYY') AS DischargeDate,

    DominantProcedureSpell,

    LoS;

SQL SELECT AccountingYearMonth as AccountingPeriod,

    AdmiDate AS StartDate,

    Age,

    SpellDisDate AS DischargeDate,

SpellDominantProcedure AS DominantProcedureSpell,

    SpellLoS AS LoS,

FROM SLAM.dbo."1415SLAMTAS";

Colin-Albert
Partner - Champion

prabhu0505
Specialist

Date(Date#(AdmiDate, 'YYYYMMDD'), 'DD/MM/YYYY') AS StartDate

Date(Date#(SpellDisDate, 'YYYYMMDD'), 'DD/MM/YYYY') AS DischargeDate