Database Reference
In-Depth Information
Figure 7.4
Create user-deined multistatement table function.
Figure 7.5
Use user-deined multistatement table function.
As shown in Figure 7.5, the student with id 10 enrolled in the classes 1000, 1001, 1002, and
1005. herefore, all the information about the students in those classes is displayed.
7.3.1.3 APPLY Operator
Sometimes you may want to match the result set returned by a table-valued function to speciied
rows of another table. For example, you may want to ind the classmates for each class listed in the
table CLASS. To do so, you can apply the table-valued function fnClassmate against each row in
the table CLASS by using the APPLY operator. here are two types of APPLY: CROSS APPLY and
OUTER APPLY. CROSS APPLY only returns those rows in the table CLASS that are related to
the result set returned by the function fnClassmate. OUTER APPLY returns all rows in the CLASS
table, even if a class has no student. NULL will be returned if there is no match from the table-valued
Search WWH ::




Custom Search