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)
为什麽错。怎麽改。 展开
2个回答
展开全部
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
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询