Hi, I am trying to create a table-valued function that takes a string argument and, depending upon it's value, returns one of a number of identically-structured tables (and before someone asks why multiple identically structured tables, NOT my idea!).
I am a novice with T-SQL, but I've been attempting something like this for the function:
When 's1' then return table1
When 's1' then return table2
... but I keep getting errors. Can someone help get the ball rolling and show me the basics on how to set up a function to do this? I'm hoping since I'm just redirecting to existing tables that this function will have minimal performance hits.
View Complete Post