CREATE PROCEDURE [dbo].[usp_PageResults_NAI] ( @startRowIndex int, @maximumRows int)ASDECLARE @first_id int, @startRow int -- A check can be added to make sure @startRowIndex isn't > count(1)-- from employees before doing any actual work unless it is guaranteed-- the caller won't do that-- Get the first employeeID for our page of recordsSET ROWCOUNT @startRowIndexSELECT @first_id = employeeID FROM employees ORDER BY employeeid-- Now, set the row count to MaximumRows and get-- all records >= @first_idSET ROWCOUNT @maximumRowsSELECT e.*, d.name as DepartmentName FROM employees e INNER JOIN Departments D ON e.DepartmentID = d.DepartmentIDWHERE employeeid >= @first_idORDER BY e.EmployeeIDSET ROWCOUNT 0GO
( @startRowIndex int, @maximumRows int)ASDECLARE @first_id int, @startRow int -- A check can be added to make sure @startRowIndex isn't > count(1)-- from employees before doing any actual work unless it is guaranteed-- the caller won't do that-- Get the first employeeID for our page of recordsSET ROWCOUNT @startRowIndexSELECT @first_id = employeeID FROM employees ORDER BY employeeid-- Now, set the row count to MaximumRows and get-- all records >= @first_idSET ROWCOUNT @maximumRowsSELECT e.*, d.name as DepartmentName FROM employees e INNER JOIN Departments D ON e.DepartmentID = d.DepartmentIDWHERE employeeid >= @first_idORDER BY e.EmployeeIDSET ROWCOUNT 0GO
Remember Me