Inline function rules
-
The RETURNS clause contains only the keyword table.
You do not have to define the format of a return variable, because it
is set by the format of the result set of the SELECT statement in the
RETURN clause.
-
There is no function_body delimited by BEGIN and END.
-
The RETURN clause contains a single SELECT statement in
parentheses. The result set of the SELECT statement forms the table
returned by the function. The SELECT statement used in an inline
function is subject to the same restrictions as SELECT statements used
in views.
-
The table-valued function accepts only constants or @local_variable arguments
CREATE FUNCTION dbo.fx3 ( @eid int ) RETURNS TABLE AS RETURN ( SELECT * FROM emp WHERE eid = @eid ) EXECUTE:
SELECT EID, NAME, DID, SAL, MGR FROM dbo.fx3(3) AS fx3_1
Press Me
No comments:
Post a Comment