tags:

views:

10

answers:

2

I'm trying to add a new table-valued udf to an existing LINQ-to-SQL designer in VS 2008. Everything goes fine and there are no compile errors or warnings; however when I try to execute the method I get the following error:

System.InvalidOperationException: The method is not mapped as a stored procedure or user-defined function...

I've checked the connection string, made sure the udf exists in the target database, and successfully queried another udf that was added previously. The Function attribute is present in the generated designer code. I've deleted the file and recreated it from scratch with the same results. I've successfully added udfs before and am baffled by this turn of events. Have I missed something?

A: 

Is there anything "funny" in the UDFs signature? Does it return any columns without names, columns sharing the same name, columns using an unsupported datatype or something like that?

KristoferA - Huagati.com
Not that I can tell. I copied an existing function changed the name, the parameter and the where clause.
Kathleen S.
A: 

Here's the function:

ALTER FUNCTION [dbo].[GetIndividualInfoByName]
(
    @Name varchar(50)
)
RETURNS TABLE 
AS
RETURN 
(
    SELECT
        Id
        ,Ssn
        ,FamilyName
        ,MiddleName
        ,GivenName
        ,Suffix
        ,Street1
        ,Street2
        ,Street3
        ,City
        ,[State]
        ,PostalCode
        ,Country
    FROM 
        Delta.dbo.IndividualInfo
    WHERE
        GivenName LIKE @Name Or FamilyName LIKE @Name
)
Kathleen S.