Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 185581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:29:43+00:00 2026-05-11T15:29:43+00:00

Would someone please help me. I have a stored procedure (see below) for data

  • 0

Would someone please help me.

I have a stored procedure (see below) for data paging in SQL Server 2005. The purpose of the stored procedure is to return a page of Products (prodid, description) for a particular Category (CatID).

When I execute the stored procedure:

EXEC @return_value = [dbo].[ecosys_CNET_GetCategoryProducts]   @CatID = N'AA',   @PageNumber = 1,   @ProductsPerPage = 10,   @HowManyProducts = @HowManyProducts OUTPUT  

it only returns one (1) row even though there are many Products:

@HowManyProducts: 10034 

I have a similar stored procedure which works just fine for smaller datasets. Am I hitting some sort of limit?

set ANSI_NULLS ON   set QUOTED_IDENTIFIER ON   go    CREATE PROCEDURE [dbo].[ecosys_CNET_GetCategoryProducts]    (   @CatID char(2),   @PageNumber INT,   @ProductsPerPage INT,   @HowManyProducts INT OUTPUT   )    AS    -- Declare a new @Products TABLE variable.   DECLARE @Products TABLE   (   RowNumber INT,   prodid VARCHAR(40),   description VARCHAR(2000)   )    -- Populate the @Product TABLE variable with the selected Products.   INSERT INTO @Products    SELECT    ROW_NUMBER() OVER (ORDER BY cds_atr.prodid),   cds_atr.prodid,   cds_stdnee.description    FROM cds_stdnee    JOIN cds_atr   ON (cds_stdnee.prodid = cds_atr.prodid)    WHERE cds_atr.catid = @CatID    -- Return the Total Number of Products using an OUTPUT variable.   SELECT @HowManyProducts = COUNT(prodid) FROM @Products    -- Extract the Requested Page of Products.   SELECT DISTINCT prodid, description    FROM @Products    WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage     AND RowNumber <= @PageNumber * @ProductsPerPage 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:29:44+00:00Added an answer on May 11, 2026 at 3:29 pm

    If it’s only returning one row, chances are there is only one row to return. Add a SELECT * FROM @Products and look to see what rows were there. In particular, look at the row numbers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a small stored procedure on SQL server 2008. I have little
Why would someone use WHERE 1=1 AND <conditions> in a SQL clause (Either SQL
I'm quite confused about several books in .NET that I have read. Would someone
I was wondering if someone would be able to help me write a CQL
Why would someone want to use a linked-list over an array? Coding a linked-list
Why would someone use a group by versus distinct when there are no aggregations
Why would someone use numeric(12, 0) datatype for a simple integer ID column? If
A simple question, but could someone provide sample code as to how would someone
I suppose it depends on how it's implemented. I'd love it if someone would
Could someone supply some code that would get the xpath of a System.Xml.XmlNode instance?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.