Optional" parameters?... not really, but you can set up default values for your parameters, but you have to pass them as 'DEFAULT' to the function:
[tt]
CREATE FUNCTION myFunction(@param INT = 1) RETURNS INT
AS
BEGIN
RETURN @param
END
GO
SELECT dbo.myFunction(DEFAULT)
UNION
SELECT dbo.myFunction(5)
GO
DROP FUNCTION myFunction
[/tt]
-dave
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.