maosun5918 2017-08-29 03:37 采纳率: 0%
浏览 788

存储过程进行排序,求大神解决Bug

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
图片说明

  • 写回答

1条回答

  • maosun5918 2017-08-29 03:41
    关注

    图片说明

    评论

报告相同问题?

悬赏问题

  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏