I noticed a couple other people getting this same error, but none of the solutions offered appear to be relevant to my case.
When I make a new table-valued UDF, whether in-line or multi-statement, I always get the following error when trying to use it:
Msg 4121, Level 16, State 1, Line 2
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.testtfunction", or the name is ambiguous.
Note, I am in the correct database and I can make scalar-valued functions and use them just fine.
Here is an example of a very simple test case:
Another, more complicated one:
And a third, multi-statement:
All three give the same error.
Any help would be appreciated.
-David
When I make a new table-valued UDF, whether in-line or multi-statement, I always get the following error when trying to use it:
Msg 4121, Level 16, State 1, Line 2
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.testtfunction", or the name is ambiguous.
Note, I am in the correct database and I can make scalar-valued functions and use them just fine.
Here is an example of a very simple test case:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER Function [dbo].[testtfunction] (@in smallint)
Returns @test table (twice smallint)
as
Begin
Insert @test
values (2*@in)
Return
End
Another, more complicated one:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER Function [dbo].[TfA](@TID smallint)
Returns table
as
Return(
Select NID As TID
From Keyfile
Where AB in (select "AB ID" From Extract where "Unique ID"=@TID))
And a third, multi-statement:
Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER Function [dbo].[TD](@from smallint, @in smallint)
Returns @TIDDistance Table (AID smallint, Distance float)
As
Begin
declare @TIDs Table (TID smallint)
Insert Into @TIDs
Select NID As TID
From Keyfile
Where AB in (select "AB ID" From Extract where "Unique ID"=@in)
Insert @TIDDistance
Select TID,dbo.Distance(@from,TID)
From @TIDs Where TID<>@in
Return
End
All three give the same error.
Any help would be appreciated.
-David