How to pass table to a table values function

BrookK
BrookK used Ask the Experts™
on
Hello All,

How do I pass table to a table valued function which returns table? I can test my code with one variable but I need to pass all the rows one by one to the function to get the results for all the rows returning in a table.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
can you please show your relevant code you have so far (aka the one of the function ...)
SQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2018
Commented:
You need to use CROSS APPLY function like this

SELECT  *
FROM  ur_table
CROSS APPLY ur_fn_name(ur_table.some_col1, ur_table.some_col2) AS O

Commented:
Why not use a while statement

WHILE (Expression) > Value
BEGIN
do your operation and change the expression value
END

Author

Commented:
Great and simple solution

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial