Passing Table Values into a TVF I have a TVF that takes a userID parameter.

I have another table that contains a list of these userIDs.

I want to pass all these userID values into the TVF.

I have tried this code...

    FROM [dbo].[UserData](u.UserID) data
    JOIN dbo.Users u ON u.DetailID = data.DetailID


but get the error...

The multi-part identifier "u.UserID" could not be bound.


What am I missing?
The error you're getting is that you are using an alias that is defined after the table you're currently referencing. In this instance, you will need to change the order of your tables as mentioned by Mark in the comment.

You can use a CROSS APPLY which is more similar to an INNER JOIN, or you can use an OUTER APPLY which is more similar to an OUTER JOIN. 
Based on the syntax of your query above, my guess is that you are wanting a CROSS APPLY.

To echo Mark,

FROM dbo.Users AS u
CROSS APPLY dbo.UserData(u.UserID) AS data