Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
malome64
Contributor
Contributor

How load Datetime Column from SQL?

SQL column Datum is DateTime Type, but Time part is 00:00:000.

I tested 3 metods conversion column Datum.

In QVD, DatumSQL convert to Date (32bit integer), another two to 32bit Integer + String. I need show DatumStr format on sheets.

But what about size QVD and Set Analysis?

Which date format I should use in LOAD Script?

1 Solution

Accepted Solutions
daveamz
Partner - Creator III
Partner - Creator III

Hi Marian,

It is better to use the preceding load and format the date using Qlik's Date() function or Timestamp() if you want to keep also the time. Or, as the best practice dictates, it is better to split the date and the time in separate fields:

Test:

LOAD

     Date(Floor(Datum), 'DD.MM.YYYY') AS Date, //Floor will keep only the date from a timestamp

     Time(Datum, 'hh:mm:ss')                     AS Time;

SQL SELECT

      Datum

FROM dbo.table;

Regards,

David

View solution in original post

3 Replies
daveamz
Partner - Creator III
Partner - Creator III

Hi Marian,

It is better to use the preceding load and format the date using Qlik's Date() function or Timestamp() if you want to keep also the time. Or, as the best practice dictates, it is better to split the date and the time in separate fields:

Test:

LOAD

     Date(Floor(Datum), 'DD.MM.YYYY') AS Date, //Floor will keep only the date from a timestamp

     Time(Datum, 'hh:mm:ss')                     AS Time;

SQL SELECT

      Datum

FROM dbo.table;

Regards,

David

marcus_sommer

I suggest just to load Datum from the database and convert it properly (pure numeric will be sufficient) within a Preceding Load and connect this field to a master-calendar: How to use - Master-Calendar and Date-Values‌ which could contain all your needed period-fields in all formattings.

- Marcus

Vamsi0529
Contributor II
Contributor II

Is it possible doing the transformation in SQL level instead of doing transformations in qlik

Eg:

Test:

LOAD

     Datum;

SQL SELECT

      Datum ( I want the date transformation here only, Need format YYYY/MM/DD )

FROM dbo.table;