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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to exclude data within the script from being loaded


I am new to QlikView and am trying to pull data in from a SQL server, but want to be able to exlude certain data. Here is the code that i have so far, but for some reason it does not like my "WHERE" syntax. Any help would be greatly appreciated.

ODBC CONNECT32 TO Commercial_Planning;

SQL SELECT*

FROM "TM".dbo."TM_t_SD",

WHERE "SD_U_R_I" <> 396427820, OR "SD_U_R_I" <> 396426860;

4 Replies
peschu123
Partner - Creator III
Partner - Creator III

Hi Patrick,

I only would exclude the data if the amount is huge and you are really sure that you will never need this data.

If you are not 120% sure that you need it or not, you probably should load it all and use a flag field to mark (ir-) relevant data.

Hope it helps and best Regards,

Peter

maxgro
MVP
MVP

this is not a Qlikview problem; it's a SQL problem: if you try with some sql tools (SqlServer Management Studio, ....) you'll get the same

to fix it I think

- remova comma

- replace OR with AND (I suppose you don't want 396427820 and 396426860)

ODBC CONNECT32 TO Commercial_Planning;

SQL SELECT*

FROM "TM".dbo."TM_t_SD"

WHERE "SD_U_R_I" <> 396427820 AND "SD_U_R_I" <> 396426860;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In addition to the other suggestions, if you are getting a syntax error it may be that that your values are char fields in which case you should include them in single quotes:

'396427820'

-Rob

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You don't say what your ODBC source is, but if you have a tool to develop queries (eg Toad or MSSQL Management Studio), develop and test the queries there, then paste them into your script with a SQL prefix. QV passes the text after SQL verbatim to the ODBC provider.

This way you can be sure that the query is working and returning the data you expect before adding to your QV script.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein