No. Conceptually, how would you expect to handle a function that returned a variable number of tables? You would JOIN on two tables at once?
What if the returned fields don't line up? Is there some reason you can't have a TVF for each filter?
Conceptually, I suppose I would want to be able to index each table in the results. @Results0, @Results1, @Results2. Though... this doesn't really exist in TSQL, so it's a wash.
However, having a TVF for each filter like you mentioned I think may be the most appropriate solution. Thanks! – Sheldon Warkentin Nov 23 at 21:18 1 @SheldonWarkentin - referencing by index implies you will have the function listed more than once.To me that means you will be running it more than once as well, which is a whole other issue.
– JNK Nov 23 at 21:20.
As others say, NO. A function in TSQL must return exactly one result (although that result can come in the form of a table with numerous values). There are a couple of ways you could achieve something similar though.
A stored procedure can execute multiple select statements and deliver the results up to whatever called it, whether that be an application layer or something like SSMS. Many libraries require you to add additional commands to access more result sets though. For instance, in Pyodbc to access result sets after the first one you need to call cursor.nextset() Also, inside a function you could UNION several result sets together although that would require each result set to have the same columns.
One way to achieve that if they have a different column structure is to add in nulls for the missing columns for each select statement. If you needed to know which select statement returned the value, you could also add a column which indicated that. This should work with your simplified example since in each case it is just returning a single ID column, but it could get awkward very quickly if the column names or types are radically different.
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.