This is the basic structure of how to dynamically create a pivot table recordset for SQL 2000. In this example, I am using SUM, but it could just as easy be COUNT or any other aggregate function.
Creating a PDF from a Stored Procedure in SQL Server
A short but interesting article, the author has figured out a way to create a PDF from a stored procedure without using a third party library.
2019-09-20 (first published: 2003-08-26)