If I was using a stored procedure, I would probably just
set up an output parameter with the count.

SET NOCOUNT ON
     SELECT @myOutputVar = COUNT(*) FROM TABLE
     SELECT * FROM TABLE
SET NOCOUNT OFF

Unless there's a specific need for EACH row to also return
the total in the table, but for the life of me I can't come up with
a reason.

Chris Tifer

----- Original Message -----
From: "Steve Abaffy" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Wednesday, October 09, 2002 7:42 AM
Subject: OT: Quick SQL Query Question


> Hello,
>
> How do I write a query that will return all the rows in a table with the
> addition of the count of those rows?
> Something like
>
> Select Count(*),* From table
>
> Thanks in Advandce
>
>
>
> ---
> You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%
>


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to