[b] 要求是  创建借阅明细查询存储过程要求:根据读者编号,查找借阅未还的书籍,并按照应还时间升序排列,注意超期书籍的应还时间列内容为“应还时间 超期”如“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[/b]