关于存储过程语法的问题,答对了即刻给分。

caijf caijf 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我写了如下一存储过程,但不知道错在什么地方,
create proc base_tj_destroy
@type int,@name char(20),@starttime datetime,@endtime datetime
as
case @type of
0: begin
select * from change
where (part='固定设备') and (destroy_date>=@starttime)
and (destroy_date<=@endtime)
end
1: begin
select * from change
where (part='固定设备')and(destroy_date>=@starttime)
and (destroy_date<=@endtime) and(usedept_num=@name)
end
2: begin
select * from change
where (part='固定设备')and(destroy_date>=@starttime)
and (destroy_date<=@endtime) and(borrow_people=@name)
end
end
不知道是不是在存储过程中不能用case语句,但我该用if语句来做判断,似乎也不行。请高手指点...
...全文
评论 8
收藏 已收藏
分享
返回顶部
caijf
MS-SQL Server 34,876 成员 254,635 内容