I’m afraid the answer to this is “NO, you can’t”, but since I can’t find this explained anywhere I’m gonna ask anyway. Given a user defined table type: And a function that returns that type: And another function that accepts that type: Since the return value of fnFind fits the value that is accepted by fnName, I’d hoped that I
Tag: table-valued-parameters
WHERE IN performs much better with Table Type than with hardcoded values in SQL Server
I have 2 queries that are essentially the same (at least if I didn’t miss something). I was thinking that one cannot beat constants declared in the query itself, but apparently the first query is few times slower than the second one. It seems that SQL server is not smart enough to provide a good plan for the hardcoded values,