谁能帮忙改改这个存储过程的问题

tianxizhong 2014-07-03 05:34:39
要求是 创建借阅明细查询存储过程要求:根据读者编号,查找借阅未还的书籍,并按照应还时间升序排列,注意超期书籍的应还时间列内容为“应还时间 超期”如“2014-3-3 超期”
我写的代码是下面这样 但是 执行了后 应还时间@shouldtime 是NULL 我不知道改怎么让他显示值 这个按照应还时间升序排列也不会做 谁能帮忙改改 谢谢
create proc booksearch
@libcardid char(8),
@bookid varchar(20),
@state nvarchar(20) output,
@shouldertime datetime output
as
begin
if exists (select state shouldretDATEtime from t_borrow where state=0 and bookid=@bookid and libcardid=@libcardid )
begin
set @state='超期'
end
else
if exists (select state,shouldretDATEtime from t_borrow where state=1 and bookid=@bookid and libcardid=@libcardid )
begin
set @state='已归还'
end
end
...全文
65 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧