Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting a query to load top rows in qlikview

Hi community,

I have a query that I would like to use to load data into qlikview with.  It goes something like the following:

select top 1 MessageData.value('(/LogObject//Message)[1]','nvarchar(50)') from dbo.ApplicationLog

where AppCode = 'CodaReportingService'

and MessageData.value('(/LogObject//Message)[1]','nvarchar(50)') like '%*Year:2012%Period:3*%';

I've tried parts of it and can just load message data.  Do you know how I would get this query to work? 

I might be able to do a simple work around.  I need to know how do I load just the top 10 or 1 rows of the select statement?


1 Solution

Accepted Solutions
swuehl
MVP
MVP

Have you tried the FIRST prefix? From the Help:

The first prefix to a Load or Select (SQL) statement is used for loading just a set maximum number of records from the data source, regardless of its length.

The syntax is:

first n( loadstatement | selectstatement )

where:

n is an arbitrary expressing which evaluates to an integer indicating the maximum number of records to be read.

Examples:

First 10 Load * from abc.csv;

First (1) Select * from Orders; (Note: The parenthesis is allowed but not required.)

View solution in original post

2 Replies
swuehl
MVP
MVP

Have you tried the FIRST prefix? From the Help:

The first prefix to a Load or Select (SQL) statement is used for loading just a set maximum number of records from the data source, regardless of its length.

The syntax is:

first n( loadstatement | selectstatement )

where:

n is an arbitrary expressing which evaluates to an integer indicating the maximum number of records to be read.

Examples:

First 10 Load * from abc.csv;

First (1) Select * from Orders; (Note: The parenthesis is allowed but not required.)

Not applicable
Author

Thanks for the answer!