SQL 创建存储过程错误 关键字 'select' 附近有语法错误。应该怎麽改
usetingchechangcreateprocedurePROCFee@车牌号码char(7),@FeeintoutputasselectCarNum,Intime,...
use tingchechang
create procedure PROCFee
@车牌号码 char(7),
@Fee int output
as
select CarNum,Intime,Outtime,@Fee as'Fee'
from Park
where Outtime is not null and CarNum=@车牌号码 and
select @Fee=case
when datediff(n,Intime,Outtime)>='480' then 60
when datediff(n,Intime,Outtime)>='30' then datediff(n,Intime,Outtime)*8
ELSE 0
END
执行显示:
关键字 'select' 附近有语法错误。(select @Fee=case)
为什麽错。怎麽改。 展开
create procedure PROCFee
@车牌号码 char(7),
@Fee int output
as
select CarNum,Intime,Outtime,@Fee as'Fee'
from Park
where Outtime is not null and CarNum=@车牌号码 and
select @Fee=case
when datediff(n,Intime,Outtime)>='480' then 60
when datediff(n,Intime,Outtime)>='30' then datediff(n,Intime,Outtime)*8
ELSE 0
END
执行显示:
关键字 'select' 附近有语法错误。(select @Fee=case)
为什麽错。怎麽改。 展开
展开全部
use tingchechang
go
create procedure PROCFee
(
@车牌号码 char(7),
@Fee int output
)
as
select CarNum,Intime,Outtime,@Fee as'Fee'
from Park
where Outtime is not null and CarNum=@车牌号码 and
@Fee=case--去掉Select
when datediff(n,Intime,Outtime)>='480' then 60
when datediff(n,Intime,Outtime)>='30' then datediff(n,Intime,Outtime)*8
ELSE 0
END
go
create procedure PROCFee
(
@车牌号码 char(7),
@Fee int output
)
as
select CarNum,Intime,Outtime,@Fee as'Fee'
from Park
where Outtime is not null and CarNum=@车牌号码 and
@Fee=case--去掉Select
when datediff(n,Intime,Outtime)>='480' then 60
when datediff(n,Intime,Outtime)>='30' then datediff(n,Intime,Outtime)*8
ELSE 0
END
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询