drop function fnSectionGrade
create function fnSectionGrade(@section varchar(50))
returns numeric(12)
AS
begin
declare @return numeric(12)
if patindex('%以下%',@section)<>0
set @return=0
if patindex('%以上%',@section)<>0
set @return=999999999
if patindex('%以上%',@section)=0 and patindex('%以下%',@section)=0
begin
set @return=cast(left(@section,charindex('-',@section)-1) as int)+cast(right(@section,len(@section)-(charindex('-',@section))) as int)
end
return @return
end