15 pts.
 DB2 Web Query record count
Is there a simple way to show a count of the rows printed in DB2 Web Query, such as you can to in Query/400?

Software/Hardware used:
ASKED: September 30, 2009  3:59 PM
UPDATED: October 1, 2009  2:21 PM

Answer Wiki:
Is this what you are looking for? your original query SELECT ..... FROM ... WHERE ... then follow up with SELECT COUNT(*) FROM ... WHERE ... use the same FROM and WHERE clauses and it will give you a count. Alternatively, does your product have access to the equivalent of the DB2 SQLCA? In the SQLCA, the first occurrence of SQLERRD contains the number of rows in the result set when you hit SQLCODE +100.
Last Wiki Answer Submitted:  September 30, 2009  7:07 pm  by  Meandyou   5,205 pts.
All Answer Wiki Contributors:  Meandyou   5,205 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Steve,

Thanks, but where would you enter this SQL in DB2 Web Query Report Assistant in order to show the count of # of rows on the report (to be similar to the row count in Query/400?

 15 pts.

 

Since I don’t know Web Query Report Assistant I can’t say where one would put it.

Could you use a UNION to append the COUNT to your original query?

SELECT …
FROM …
WHERE …
UNION
SELECT ‘value’ , COUNT(*)
FROM …
WHERE …
ORDER BY …

where ‘value’ is high value ( like x’FF’ ) to force that row to sort last

 5,205 pts.