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
 Get Page

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2010-11-01 : 12:16:34
Hello,

I have the following table:

create table dbo.Errors
(
Id int identity not null,
constraint Errors_Id_PK primary key clustered (Id),
[Application] nvarchar(60) not null,
Content nvarchar(max) not null,
Created datetime not null,
Host nvarchar(50) not null,
[Message] nvarchar(500) not null,
[Source] nvarchar(60) not null,
[Status] int not null,
[Type] nvarchar(100) not null,
[User] nvarchar(50) not null
) -- Errors

I need to get a "page of errors" given an pageIndex and pageSize.

So if pageIndex = 20 and pageSize = 10 I will start at the twentieth item and take 10 items.

I can't use Id as index because if I delete an item, for example Id = 5, then the twentieth item does not coincide with its Id.

How can I do this? Do I need to change something in my table?

Thank You,

Miguel

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-01 : 12:38:16
http://www.sqlteam.com/search.aspx?cx=011171816663894899992%3Aaow51lf_dim&cof=FORID%3A9&q=paging#1144


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -