Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored Proc that returns row count from another Stored P
Message
De
21/04/2009 12:50:44
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
21/04/2009 12:47:54
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01393595
Message ID:
01395774
Vues:
55
Bill,
I am creating a stored procedure to use in a grid where I can specify the number of rows to display and which page to display (as well as other filters). I am trying to create a stored procedure that returns the total number of rows that match all filters except the paging filters. Some of my filters are somewhat complex and I didn't want to include those in a second Stored Procedure. ADO.NET returns the number of rows affected without any explicit logic.

>Hi Mike,
>
>It may not fill your need, but I usually return the rows affected as an OUTPUT parameter from the stored proc.
>
>Bill
>
>>>Is this possible? I am working on setting up paging on a form and I don't want to duplicate the joins and filters in a second query that just returns the count. I've seen an example of creating a temp table and inserting the results of a stored procedure into that table but I wanted to see if there was an easier way.
>>
>>
>>FYI, I found the following example elsewhere that does exactly what I want to do:
>>
>>
>>EXEC dbo.sp_get_stuff;
>>SELECT @@Rowcount;
>>
>>
>>The only issue is that it returns both the resultset and the rowcount where I would like to return only the rowcount. It does allow me to only have the complex logic of the sp_get_stuff Stored Proc in one place instead of two.
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform