Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Data Format SQL SERVER 2012

Hi,

I have the following date format in my SQL SERVER = DD/MM/YYYY => Brazil Date

When I import this into Qlikview it comes across as a string like this = 20020627

When i change the format in "properties list" switch to "Data" DD/MM/YYYY The qlik view Show = 12/08/56714

Any ideas on how to change this a date in Qlikview?

Thanks

Marcos

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Error in expression:

Date# takes 1-2 parameters

Load *, Date(Date#(TJ_DTMPINI,'YYYYMMDD','DD/MM/YYYY') as NewDate

View solution in original post

8 Replies
ashfaq_haseeb
Champion III
Champion III

Load

F1,

F2,

Date(Date#(Your_Date,'YYYYMMDD','DD/MM/YYYY'),

F4;

sql select * from table;

Regards

ASHFAQ

Anonymous
Not applicable
Author

Ashfaq,

I'm new in qlick view, could you show me how to make, below is my script.

OLEDB CONNECT32 TO [Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=EBRASIL_PROD;Data Source=192.168.0.4;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=ULTRA-MARCOS;Use Encryption for Data=False;Tag with column collation when possible=False];

SQL SELECT *

FROM "EBRASIL_PROD".dbo.STJ010;

The field i want to convert is "TJ_DTMPINI"

Thanks

hic
Former Employee
Former Employee

Just use

     Load *,

          Date(Date#(TJ_DTMPINI,'YYYYMMDD'),'DD/MM/YYYY') as NewDate;

     SQL SELECT * FROM "EBRASIL_PROD".dbo.STJ010;

instead of your current SELECT statement.

The reason why you have this problem is that your date date isn't stored as a date type in the SQL SERVER. It is probably a VARCHAR or an INTEGER. Had it been a date type, it would have worked automatically.

HIC

Anonymous
Not applicable
Author

Error in expression:

Date# takes 1-2 parameters

Load *, Date(Date#(TJ_DTMPINI,'YYYYMMDD','DD/MM/YYYY') as NewDate

hic
Former Employee
Former Employee

You're right. It is corrected now. I just added the missing bracket.

HIC

Anonymous
Not applicable
Author

Sorry, you do not understand, this was the error message that QLIK returned, not what I wrote. How is the correct expression?

Thanks

hic
Former Employee
Former Employee

     Load *,

          Date(Date#(TJ_DTMPINI,'YYYYMMDD'),'DD/MM/YYYY') as NewDate;

     SQL SELECT * FROM "EBRASIL_PROD".dbo.STJ010;

HIC

Anonymous
Not applicable
Author

Allright, almost there heheh. I have more two 'date' fields, can't repeat the command. How i proceed.

Thanks.