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

Author  Topic 

xpandre
Posting Yak Master

212 Posts

Posted - 2002-05-13 : 07:43:42
can i pass optional parameter to an UDF?

if yes how?

thank you
Sam

VyasKN
SQL Server MVP & SQLTeam MVY

313 Posts

Posted - 2002-05-13 : 07:50:23
Not really. But you can assign a default value to the parameter and pass DEFAULT, when calling the function. Here's an example:

CREATE FUNCTION dbo.MyFunc
(
@p1 int = -1
)
RETURNS int
AS
BEGIN
RETURN @p1
END
GO

SELECT dbo.MyFunc(DEFAULT)
GO

--
HTH,
Vyas
http://vyaskn.tripod.com
Go to Top of Page
   

- Advertisement -