TABLE VALUE FUNCTIONS

Call parameterized functions within the FROM clause of a SELECT statement.

The function returns a table in a specified format and the results work like a table with the specified alias.

Table value functions can take 0-n nparameters.

Example - Shows how to declare a table value function that takes one parameter and outputs a table with
two columns. @outputTable works as virtual table where the output goes.

create function tvf_example ( @param1 integer )
returns @outputTable table ( col1 int ,col2 int )
as BEGIN
insert into [@outputTable] select @param1,2
end
select * from tvf_example(10248) as xxx
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.