Tuesday, October 21, 2008

Paging in Procedure

USE  database

GO
DECLARE @StartRow INT
DECLARE @EndRow INT
SET @StartRow = 120
SET @EndRow = 1

CREATE TABLE #tables (RowNumber INT IDENTITY(1,1),
memno VARCHAR(100), name VARCHAR(100),
email VARCHAR(100))
INSERT INTO #tables (memno, name, email)
SELECT PC.memno, PC.name, PC.email
FROM registration PC
ORDER BY memno, name, email

SELECT RowNumber, memno, name, email
FROM #tables
WHERE RowNumber > @StartRow
AND RowNumber < @EndRow
DROP TABLE #tables
GO

web hosting
counter