Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Specialist
Specialist

Just try specifying the value in quotes

select * from my_database where my_type = '42'.

View solution in original post

5 Replies
aarkay29
Specialist
Specialist

Just try specifying the value in quotes

select * from my_database where my_type = '42'.

ogster1974
Partner - Master II
Partner - Master II

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
Partner - Champion III
Partner - Champion III

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
Author

Thanks for your input!

Not applicable
Author

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