Question Nirshanthini Kugappiriyan · Oct 24, 2023

EnsLib.SQL.OutboundAdapter - Getting the row count for Select Query

We would like to know how to get the Row Count of the SELECT query. We query external database via ODBC connection. 

//tSQL- is a select query. 

Set tStatus = ..Adapter.ExecuteQuery(.tResult,tSQL)

We are trying to get the row count of the retrieved records as below; but It doesn't return any value. 

tResult.%ROWCOUNT

$$$TRACE("Result set returned with "_tResult.%ROWCOUNT_" row(s).")

Product version: IRIS 2022.1

Comments

Nirshanthini Kugappiriyan · Oct 24, 2023

We tried to use tResult.%SQLCODE option also, but we got the same results. It didn't return any result.

1
Luis Angel Pérez Ramos · Oct 25, 2023

%ROWCOUNT doesn't return the total of rows returned by the SELECT, you'll need to execute a previous SELECT COUNT(*) if you want to know the number of rows.

You can read here how %ROWCOUNT is used.

1