create function biantolunscore
returns @score1 (int)
begin
select 刊物级别 as 刊物级别
case
when 刊物级别='核心期刊' then 100
when 刊物级别='一般期刊' then 90
when 刊物级别='报纸杂志' then 80
when 刊物级别='会议论文' then 70
end as score
from 论文
消息 156,级别 15,状态 1,过程 biantolunscore,第 3 行
关键字 'begin' 附近有语法错误。
消息 156,级别 15,状态 1,过程 biantolunscore,第 5 行
关键字 'case' 附近有语法错
谢谢
------解决方案--------------------
- SQL code
create function biantolunscorereturns @score1 (int)begin select 刊物级别 as 刊物级别 , --这缺个逗号 case when 刊物级别='核心期刊' then 100when 刊物级别='一般期刊' then 90when 刊物级别='报纸杂志' then 80when 刊物级别='会议论文' then 70end as scorefrom 论文end --这缺个end
------解决方案--------------------
- SQL code
CREATE TABLE chen( id int, title varchar(20), types varchar(20))INSERT INTO chen(id,title,types)VALUES(1,'第一刊物','核心期刊')INSERT INTO chen(id,title,types)VALUES(2,'第二刊物','报纸杂志')INSERT INTO chen(id,title,types)VALUES(3,'第三刊物','一般期刊')INSERT INTO chen(id,title,types)VALUES(4,'第四刊物','核心期刊')INSERT INTO chen(id,title,types)VALUES(5,'第五刊物','报纸杂志')INSERT INTO chen(id,title,types)VALUES(6,'第六刊物','报纸杂志')INSERT INTO chen(id,title,types)VALUES(7,'第七刊物','一般期刊')INSERT INTO chen(id,title,types)VALUES(8,'第八刊物','会议论文')INSERT INTO chen(id,title,types)VALUES(9,'第九刊物','会议论文')INSERT INTO chen(id,title,types)VALUES(10,'第十刊物','核心期刊')