SQL 创建存储过程错误 关键字 'select' 附近有语法错误。应该怎麽改

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)
为什麽错。怎麽改。

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
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-12-02
我记得在存储过程中的
select 是和into使用的
select name,age into @name,@age from table
相似回答