John Butler
John Butler

Reputation: 133

How do you pass a column value to a function that returns a table

I have a stored procedure that takes an int and returns a table that's used in a left join. I'd like to create a view instead of calling the procedure. Is there any way to do this? I'm getting "multi-part identifier couldn't be bound"

Example:

select users.*, extended.* 
from users left join dbo.getaggregateproperties(users.Id) as extended
on users.userid = extended.extendedid

Upvotes: 0

Views: 42

Answers (1)

Horaciux
Horaciux

Reputation: 6487

Use CROSS APPLY instead

SELECT users.*, extended.*
FROM users
CROSS APPLY dbo.getaggregateproperties(users.Id) as extended
WHERE users.userid = extended.extendedid

Upvotes: 2

Related Questions