create function statusGrade
(@status as varchar(11))
returns varchar(11)
as
-- Process
begin
declare @mark as char(1)
set @mark = ('A''B''C')
if (@mark = 'A' or @mark = 'B' or @mark = 'C')
set @status = 'success'
return @status
if (@mark = 'D' or @mark = 'E')
set @status = 'fail'
return @status
end
选择statusGrade('A')<-这是我的输入
当我尝试执行它时出现错误:
'statusGrade'不是公认的内置函数名称。
答案 0 :(得分:0)
您将需要添加dbo
前缀,如下所示:
SELECT [dbo].[statusGrade] ('A')