tags:

views:

109

answers:

1

I have a table with values in one column which have to be splitted by some function, let say F. The function F takes the value and splits it into a table of values - the result is a table.

What is the most effective way to apply this function to every value of the source table and have the result table with all values splitted? I know I could use a cursor but I wonder if there exists some smarter solution?

The result should be something like:

SELECT F(column) FROM SourceTable

But this is not possible because F is table-valued.

+2  A: 

A CROSS APPLY should do the trick.

SELECT *
FROM SourceTable
     CROSS APPLY F(Column)
Lieven