I have migrated a database from oracle, and now have a few Scalar-valued Functions.
However, when I call them, I get an error saying:
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.chk_mgr", or the name is ambiguous.
I'm calling it like this:
What am I doing wrong?
Are you sure it's not a
The reason I ask:
CREATE FUNCTION dbo.chk_mgr(@mgr VARCHAR(50)) RETURNS @mgr_table TABLE (mgr_name VARCHAR(50)) AS BEGIN INSERT @mgr_table (mgr_name) VALUES ('pointy haired boss') RETURN END GO SELECT dbo.chk_mgr('asdf') GO
Msg 4121, Level 16, State 1, Line 1 Cannot find either column "dbo" or the user-defined function or aggregate "dbo.chk_mgr", or the name is ambiguous.
SELECT * FROM dbo.chk_mgr('asdf') mgr_name ------------------ pointy haired boss
Make sure you have the correct database selected. You may have the master database selected if you are trying to run it in a new query window.
That syntax works fine for me:
CREATE FUNCTION dbo.test_func (@in varchar(20)) RETURNS INT AS BEGIN RETURN 1 END GO SELECT dbo.test_func('blah')
Are you sure that the function exists as a function and under the dbo schema?
You are using an inline table value function. Therefore you must use Select * From function. If you want to use select function() you must use a scalar function.
Can do the following
PRINT dbo.[FunctionName] ( [Parameter/Argument] )