Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with data type while loading from SQL Server

Hi! I am trying to load data into a QLikView document but I am facing some problems since it seems that during load, data type are "discarded". Example: I have a "Contract Number" that is a varchar, but when I try to load contract # = "1" and contract #="01", for the document both #'s are the same: "1".

Any ideas will be welcome.

Regards,

Gilberto.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Use the text function -- text([Contract Number]) as [Contract Number]) -- to preserve the leading 0.

-Rob

View solution in original post

5 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Use the text function -- text([Contract Number]) as [Contract Number]) -- to preserve the leading 0.

-Rob

Not applicable
Author

Rob,

Thanks for the advice, but the problem is during data load and in the load script "text" is not recognized as a valid function name.

Regards,

Gilberto.

Anonymous
Not applicable
Author

Are you using a preceding load?

Load text([Contract Number]) as [Contract Number];

SQL SELECT *

FROM SQLDATA_TABLE;

Not applicable
Author

Thank you! This worked. Just a comment: since I have to include many fields more than the "Contract Number", the syntax for the Load and the Select should be:

Load text([Contract Number]) as [Contract Number], Other_Field1, Other Field3;

SQL SELECT *

From SQLDATA_TABLE;

hector
Specialist
Specialist

yes, that is the sintax, but '*' works too, but be carfeful, because if you do this, maybe QV gives you an error Duplicate Names are not allowed, because you used an alias with the same name of the original field

This should be work fine

Load

*,

text([Contract Number]) as [Contract Number Text]

;

SQL SELECT *

From SQLDATA_TABLE;

bye