Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-03-22 : 08:40:44
|
| Merav writes "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 exceededIs 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 BEGIN IF @Syn IS NULL RETURN 1DECLARE @NewPersonID INTSELECT @NewPersonID = MAX(PersonID)FROM GO_Test WHERE SynagogueID = @SynRETURN ISNULL(@NewPersonID + 1, 1)ENDI call the function from the 'Formula' propery of a computed field of a table like this:([dbo].[TestFunc]([SynagogueID]))while SynagogueID is a field on the same table.When opening the table from the MS sql server I get the error mentioned above." |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-22 : 10:03:04
|
| Merav,What do you mean by -- Microsoft SQL Server 2000 viewer ? -- opening the table from the MS sql server ?Did u try calling ur function as : Select dbo.TestFunc([SynagogueID])-- U can check whether Max does something (I don't think it will in this case) , by replacing that with a hardcoded valu for testing-- Also wite a simple function and check whether the function is incorrect or the method of calling is incorrect |
 |
|
|
|
|
|