Ok if I took the exact code out of the table function, how would I reference the columns from the main stored procedure – mattgcon Nov 10 '10 at 20:21 Oh wait, this would not be good for memory purposes. This will be called approx. 230 times when ran – mattgcon Nov 10 '10 at 20:26 Take the function, remove the WHERE clause, and add PARTICIPANT_ID to the SELECT list; that's your view.
You then JOIN to it just as if it were a table, on Participant_ID. Let me know if you need more, I'll do it in a separate answer. – Stu Nov 10 '10 at 22:57 The view worked perfectly thank you – mattgcon Nov 10 '10 at 22:46.
You can use outer apply or inner apply to use a function table like a regular one: select * from users you outer apply dbo. Fn_YourFunction(u. Id) yf This would return all columns from the function.
I added a stripped down version of the stored procedure and teh table function – mattgcon Nov 10 '10 at 20:14 @mattgcon: So, add outer apply dbo. YourFunction(WebPersonalInfo. UserID) to the query?
– Andomar Nov 10 '10 at 20:16 I tried to add this after all of the joins but I am getting an "Incorrect Syntax near the keyword 'outer'" and all I am doing is adding right after the last inner join – mattgcon Nov 10 '10 at 20:19 Is your database in 2000 compatibility mode? (Visible in properties of the database) – Andomar Nov 10 '10 at 20:20 What version of SQL Server are you using? (Never mind -- missed the 2005 tag) – Stu Nov 10 '10 at 20:23.
Not sure exactly what you are asking, but reading a little into this... You can join to a table-valued function: SELECT * FROM existing tables and joins LEFT JOIN tvf(@userid /* param to SP */) ON whatever You can also apply the table-valued function to the row: SELECT * FROM existing tables and joins OUTER APPLY tvf(userid /* column from above joins */).
You can retreive data from a sql function using SELECT * FROM yourfunction(). So perhaps you can use some JOINS on UserID to your main SELECT along with yourfuncition() as shown above. You will need to be more specific to get a better answer.
Added stored procedure code and table function above – mattgcon Nov 10 '10 at 19:49.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.