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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get the number of rows from an outside table before loading

Hi,

This sounds easy but I havent found an easy way to do it.

I need to load several tables from a SQL Server database. The problem is that I don´t know the number of rows in them. I would like to get a count of rows before I launch the load statement to know how log it will take.

I used the following on an Oracle database, but I gives me a ODBC Read Failed error in SQL Server

load *;

sql select count (*)

from odbc_database;

Thanks

1 Solution

Accepted Solutions
SunilChauhan
Champion II
Champion II

delete old dsn for odbc and create new

then follow

as suggest by Mayil Vahanan Ramasamy

or count(*) also should work

hope this helps

Sunil Chauhan

View solution in original post

4 Replies
MayilVahanan

HI

NoOfRows('TableName') will use in this case.

For ex:

Load NoOfRows('TableName') as NoOfRowsInTableName AutoGenerate 1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
johnpaul
Partner - Creator
Partner - Creator

could you modify the SQL database to have a stored proc that would do the count(*) and return the number.

then in the load statement, you use an if statement to load the records if it's appropriate.

I know that with MS SQL we can use count * without a problem using the direct MS SQL connector

Not applicable
Author

Thankyou, but I only have read rights to the Data Base. I actually got the information using a different tool to read the database structure, but though the QV might have a function when selecting the table (where I can see the strucutre and the different columns)

SunilChauhan
Champion II
Champion II

delete old dsn for odbc and create new

then follow

as suggest by Mayil Vahanan Ramasamy

or count(*) also should work

hope this helps

Sunil Chauhan