55 sec to fetch, process and display 2.3 million rows isn't all that bad.
It's not necessarily that function that's the problem, it's the usage of that function in complex queries (ie anything with a join and/or a where). Because of the table variable, SQL can't get a cardinality estimate for the function and is going to assume 1 row. Since it actually returns 2.3 million, that's a really bad estimate and it's very likely to cause seriously bad execution plans for other queries.
I assume replacing that with a stored proc and temp table is out of the question?
Is dbo.fn_getOrgIDList(@strID) also a multi-statement table valued function?
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass