I'm working IIS 4, and the problem is that I don't want to get the whole resoult set but 50 rows each time.
Note that the where clause of the select query is dynamic , meens that I can't use a fixed identity column.
I can run a stored procedure with the where clause that will update my identity column but this will not help because their are many users and each one of them can make a defrent where caluse.
Main Topics
Browse All Topics





by: gpbuenrostroPosted on 1999-11-25 at 08:31:06ID: 2234560
In SQL server there is no ROWNUM pseudocolumn as in Oracle. However, you can use any of these alternatives:
e_name'))
- ROWCOUNT option of SET statement.
- TOP argument of SELECT statement.
- IDENTITY function.
Taking into account your sample query you must use IDENTITY function. For more detail, see "IDENTITY (Function)(T-SQL)" topic in BOL.
Consider next code and let me know if it solves your problem:
if exists
(select *
from tempdb..sysobjects
where id
=object_id(N'tempdb..#tabl
drop table #table_name
select rownum=IDENTITY(int,1,1)
,col1
,col2
into #table_name
from table_name
order by
col1
select *
from #table_name
where rownum>50 and
rownum<100
Note you are responsible for specifying the sort for the result set. ORDER BY clause affects the rownum column of each row.
PD: If you need a better advice post your table's structure.