SQL Server Enterprise Manager RRS feed

  • Question

  • I am trying desparately to build a user defined function on the Microsoft SQL Server 2000 viewer and when it is performed I get the following message:

    [Microsoft][ODB SQL Server Driver][SQL Server] Maximum stored procedure, function, trigger, or view nesting level exceeded

    Is there any problem using sql MAX() built in function? How can I resolve this issue?

    The UDF code is:
    CREATE  FUNCTION TestFunc (@Syn int)
    RETURNS  int AS  
    IF @Syn IS NULL
        RETURN 1
    DECLARE @NewPersonID INT
    SELECT @NewPersonID = MAX(PersonID)
    FROM GO_Test
    WHERE SynagogueID = @Syn
    RETURN ISNULL(@NewPersonID + 1, 1)
    I call the function from the 'Formula' propery of a computed field of a table like this:

    while SynagogueID is a field on the same table.

    Monday, March 20, 2006 1:15 PM

All replies