Results 1 to 6 of 6

Thread: selecting any no. of rows

  1. #1
    Join Date
    Jun 2005
    Posts
    3

    selecting any no. of rows

    hi,
    iam satish,
    i have a query regarding sqlserver 2000 ,how many ways to retreive a particular set of records i.e say between 30-40 or 40-50 records .

    in the front end, asp.net,10000 records will be displayed in datagrid 10 records per page,so when we click on pgno 71 it should retrieve 710-720 records only,here the query should directly retrieve 710-720 records only it shouldnot retrieve all records and choose the selected records

    please response asap
    thanks
    satish

  2. #2
    Join Date
    Feb 2003
    Posts
    1,048
    In SQL Server, you can't select rows by row number. There are work arounds you can do like query for the list of unique key fields only and then requery each page selecting the records that match the correct subset of key field values.

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    But you can add an identity column in the table and use it as row number.

  4. #4
    Join Date
    Feb 2003
    Posts
    1,048
    That would only help if returning the whole table or if inserting the results into a temp table first or doing the workaround that I suggested.

  5. #5
    Join Date
    Jun 2005
    Posts
    3

    is there is another way

    is there is any stored procedure that can help me.

  6. #6
    Join Date
    Sep 2002
    Posts
    5,938
    Don't think have that kind of general sp, you need to write some for your db.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •