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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 UDF with default values

Author  Topic 

need_some_help
Starting Member

5 Posts

Posted - 2002-01-15 : 09:15:34
I'm struggling with this one a bit. When I create the function, it allows me to allocat default values for every expected parameter. When I do this with a stored procedure, I can not pass that paraemter, and the default is used. But my function keeps complaining that I haven't provided it with enough parameters!

So how can I use the default values?

If I have this:

CREATE FUNCTION dbo.Total
(
@figure1 int = NULL,
@figure2 int = NULL,
@figure3 int = NULL,
@figure4 int = NULL,
@figure5 int = NULL,
@figure6 int = NULL,
@figure7 int = NULL,
@figure8 int = NULL,
@figure9 int = NULL,
@figure10 int = NULL
}
RETURNS int
AS
BEGIN
/* ---
-- */
END

And then by executing "SELECT dbo.Total(10,10,10) AS Total" I would expect this to work, as I'd want the default values to be used when not provided.

This doesn't seem to be the case though?


   

- Advertisement -