-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE proc_page_split1
-- Add the parameters for the stored procedure here
@pageindex int,
@pagesize int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT top (@pagesize) basic_staff.staffid, basic_staff.name,(case basic_staff.sex when 0 then '女' when 1 then '男' end) AS sex, basic_department.name AS departmentname,
basic_role.name AS rolename
FROM basic_staff LEFT JOIN
basic_department ON basic_staff.depid = basic_department.depid LEFT JOIN
basic_role ON basic_staff.roleid = basic_role.roleid
where basic_staff.ID not in (select top (@pagesize*@pageindex) ID from basic_staff) order by basic_staff.ID
END
GO
SQL分页存储过程实例
最新推荐文章于 2020-08-13 15:15:54 发布