Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

limit rows from sql

hello,

i want to limit the data load from a odbc-datasource.

select * from my_database where my_type = 42.

my_type is of data type integer.

Unfortunately qlik does not take this condition and loads everything.

what is the right syntax for qlik-sense ?

is there a cast or something necessary ?

thx for your hints!

1 Solution

Accepted Solutions
aarkay29
Not applicable

Re: limit rows from sql

Just try specifying the value in quotes

select * from my_database where my_type = '42'.

5 Replies
aarkay29
Not applicable

Re: limit rows from sql

Just try specifying the value in quotes

select * from my_database where my_type = '42'.

ogster1974
Not applicable

Re: limit rows from sql

If your having trouble the quotes might work or how about to put your SQL in a view and pass that in.

in sql

CREATE VIEW dbo.YourView

AS

select * from my_database where my_type = 42

GO

In your load script

SELECT * FROM dbo.YourView

Id also suggest you name your fields in your select statement so you dont bring in unnecessary data that can cause performance and association issues down the line as your app grows.

Regards

Andy

petter
Not applicable

Re: limit rows from sql

Most SQL databases accept the ANSI SQL LIMIT clause:

SELECT * FROM customers LIMIT 1000;

Microsoft SQL Server has it's own proprietary TOP clause that has to come immediately after the SELECT like this:

SELECT TOP 500 * FROM customers;

This is much much better to use than the FIRST prefix for LOAD since obviously the former syntax will prevent a lot of data to be extracted and sent to Qlik before it is discarded by the FIRST prefix....

However you can use it for any type of LOAD like this:

FIRST 100 LOAD * FROM mySheet.xlsx (ooxml......);

Not applicable

Re: limit rows from sql

Thanks for your input!

Not applicable

Re: limit rows from sql

thanks for your input, using rownum does pretty much the same for me.