alter procedure usp_StudentInfoDataByPage
@pageIndex int=1,--当前页
@pageSize int=5,--页面显示数据数
@Count int output,--数据总条数
@action varchar(20)--排序字段
as
begin
with t as(
select ,Row_number() over(order by gKey) as Id from StudentScore)
---------查询数据记录------------
select
t.gKey,
gStudentKey,
sName,
iSubjects,
dScore,
iSemester
from t
join StudentInfo on t.gStudentKey=StudentInfo.gKey
where t.Id between (@pageIndex-1)@pageSize+1 and @pageIndex*@pageSize
order by
case
when @action='gStudentKey' then gStudentKey
when @action='iSubjects' then iSubjects
when @action='iSemester' then iSemester
else t.gKey --cast(t.gKey as int)
end
---------查询数据记录总条数------------
set @Count= (Select Count(*) from StudentScore)
end
存储过程进行排序,求大神解决Bug
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-