If that function is a direct cut-and-paste from Enterprise manager, there's a bug in it: "Server: Msg 245, Level 16, State 1, Procedure RuntimeSort, Line 10 Syntax error converting the varchar value '/' to a column of data type int." **Edit** I see the problem. You have DATEPART() + '/' DATEPART returns an int, which you are NOT casting to a varchar. So, when you try to add '/' to an int, it tries to auto-cast the slash into an int, and the function bombs. To answer your original question, however, the proper method of defining the formula is dbo.RuntimeSort(date1, date2). You MUST provide the object owner, as well as the object name, and ALL parameters. UDF's on SQL Server 2000 don't support default parameter values like stored procs do.
Grim
(aka Toby)
MCDBA, MCSD, MCP+SB
Need a Second Life?