When a parameter of the function has a default value, the keyword "default" must be specified when calling the function in order to get the default value.
CREATE FUNCTION [ owner_name. ] function_name
( [ { @parameter_name [AS] scalar_parameter_data_type [ = default ] } [ ,...n ] ] )RETURNS scalar_return_data_type
[ WITH <> [ [,] ...n] ]
[ AS ]
BEGIN
function_body
RETURN scalar_expression
END
@parameter_name
Is a parameter in the user-defined function. One or more parameters can be declared in a CREATE FUNCTION statement. A function can have a maximum of 1,024 parameters. The value of each declared parameter must be supplied by the user when the function is executed, unless a default for the parameter is defined. When a parameter of the function has a default value, the keyword "default" must be specified when calling the function in order to get the default value. This behavior is different from parameters with default values in stored procedures in which omitting the parameter also implies the default value.
http://msdn.microsoft.com/en-us/library/aa258261(SQL.80).aspx
No comments:
Post a Comment