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

  • Home
  • SEARCH
  • 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 4544696
In Process

The Archive Base Latest Questions

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

In my C# application, I have a stored procedure which returns some kind of

  • 0

In my C# application, I have a stored procedure which returns some kind of data from the database. The input parameters which I pass to the procedure are start date, end date and a such called “number of lines” parameter. Each line represents an entry in the database. Due to the database call restrictions I can’t pass more than 5000 lines to the procedure per a call. That’s why I want to create a some kind of loop to send 5000 lines, get the corresponding data, then another 5000 lines, etc, until I get an output of lines less than 5000 which would mean that there are no more lines left. Could anybody help me with an idea on how this can be done?

Thanks.

  • 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. Editorial Team
    Editorial Team
    2026-05-21T15:42:29+00:00Added an answer on May 21, 2026 at 3:42 pm

    I see only one possible solution for you – you should select your data by primary key. The DBMS will return data ordered by primary key. You should remember key with “maximum value” and at next time you should add condition PK > “maximum value”, where PK is primary key. This will force DBMS to return to you next package of data, size of the package you can regulate by “number of lines” as previously

    [EDIT]
    I cant provide code sample because of I actually never work with DB in C#. But this fact didnt eliminate that DBMS always sorts table primary key. For example you have table with next columns:

    • ID (int) [PK]
    • DATA (CHAR255)

    In this table ID is a primary key. So you may do simething like below (pesudo code):

    < declaration of array which will hold you data from DB > - intTab
    
    SELECT * FROM < your DB tab > UP TO 5000 ROWS
      INTO CORRESPONDING FIELDS OF TABLE intTab
        WHERE < your conditions > 
          AND ID > 0.
    

    This SELECT would return to you “first” 5000 rows from table. “first” means first rows in index by primary key. To select next 5000 rows you should do:

    var maxID = < max id from intTab >
    
    SELECT * FROM < your DB tab > UP TO 5000 ROWS
      INTO CORRESPONDING FIELDS OF TABLE intTab
        WHERE < your conditions > 
          AND ID > maxID.
    

    This select will return “next” 5000 rows due ID > maxID condition.

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

Sidebar

Related Questions

I have an ETL application which extracts data from a source database (for which
I have a problem with an application which uses the same stored procedure over
We have a situation where our application calls some stored procedures on a sql
I have a c# application that interfaces with the database only through stored procedures.
I have an application where the contents of e-mails that get sent are stored
We have a current application where user login credentials are stored in a SQL
In the application I am developing I have to store the time some particular
I have a C# Application I am creating that stores all data in SQL
I have an application which will manage releases of DDL changes and TSql Executable
I have recently written an application(vb.net) that stores and allows searching for old council

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.