Applying a table function to each value of a column in the source table

I have a table with values ​​in one column that should be separated by some function, say F. Function F takes a value and splits it into a table of values ​​- the result is a table.

What is the most efficient way to apply this function to each value of the source table and have a result table with all values ​​separated? I know that I can use the cursor, but I wonder if there is a more reasonable solution?

The result should look something like this:

SELECT F(column) FROM SourceTable 

But this is not possible because F is a table value.

+4
source share
1 answer

A CROSS APPLY should do the trick.

 SELECT * FROM SourceTable CROSS APPLY F(Column) 
+6
source

All Articles