Found out that this is a feature of Qlikview.
A workaround is to read the specific column surrounded by text() like.
text(IDNR) as IDNR,
Kind of annoying since the table contains 40 columns and is read in a background qvw where new databases and tables to be fetched are added on the fly with configuration files. I don't know how to handle this, right now it is read in a separate qvw.
Qliktech support says:
The first row read from the table sets the type of the fields. (The type defined in the DB does not matter at all).
If the first row in a varchar-column has only numbers the field will be encoded as a number field - that is way the leading 0 was dropped.
If it was possible I would like a flag that could be set to true to force Qlikview to use the same types as defined in the DB-table.