Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select records with row numbers as paramters

Author  Topic 

girishhande
Starting Member

26 Posts

Posted - 2010-10-03 : 00:36:10
I want to select records from table with row numbers as parameters i.e.
@startrownumber and @endrownumber...the problem is i dont want to select all records and then filter them according to row number parameters..is it possible if yes then how?

gkh

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-10-03 : 04:05:09
if you have an ID column in your table which ia autonumber with seed:1 and increment:1 than you can easly do:


select min(id), max(id)
from MyTable
where Condition1 = 10
and Condition2 is not null
Go to Top of Page

girishhande
Starting Member

26 Posts

Posted - 2010-10-03 : 08:29:48
Hi i have some search criteria in this query so cant do it with id.and alos if some records are deleted then id will not work..any other option plz..

gkh
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-04 : 09:37:19
are you using SQL 2005?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -