函数名称中未识别

函数名称中未识别

本文介绍了函数名称中未识别“Getnetsal”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

create Function getnetsal(@Empno int)returns money
as
begin
declare @sal money,@professionFund money,@professionaltax money,@netsal money
set @professionFund = @sal*0.12;
set @professionaltax =@sal*0.03;
set @netsal=@sal-(@professionFund+@professionaltax)
return @netsal
end;

select getnetsal(1)







每当执行该函数时,函数会给出错误getnetsal不是公认的内置函数名称。



我已经使用了




whenever excute the function that function gives the error"getnetsal' is not a recognized built-in function name ".

already i used

select dbo.getnetsal(1)





但是它也没有工作





请帮帮我。

谢谢你



我尝试过:



select getnetsal(1)





每当执行该函数时函数给出错误getnetsal不是公认的内置函数名



but it is not worked also


please help me.
thank u

What I have tried:

select getnetsal(1)


whenever excute the function that function gives the error"getnetsal' is not a recognized built-in function name "

推荐答案

SELECT dbo.GetFirstWord('hello there')

它工作正常。

除了......这个功能看起来不对:你根本不给 @sal 赋值,而你没有使用参数,所以结果总是为NULL。

如果我复制你的代码,并创建teh函数,那么

It works fine.
Except...that function doesn't look right: you don;t give a value to @sal at all, and you aren't using the parameter, so the result would always be NULL.
If I copy your code, and create teh function, then

select dbo.getnetsal(1)

工作,并为我返回NULL确定。

我要检查(在SSMS下的可编程性。 ..Functions ...标量值函数)函数在正确的DB中,并且您正在对该DB执行SELECT查询。

works, and returns NULL for me OK.
I'd check (in SSMS under "Programmability...Functions...Scalar-valued functions") that the function is in the right DB and that you are executing the SELECT query against that DB.


这篇关于函数名称中未识别“Getnetsal”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 15:47