Use of user defined in SELECT clause
SELECT
ss.subscription_id AS SubscriptionId,
s.id AS ScopeId,
s.[name] AS ScopeName,
s.base AS ScopeBase,
dbo.iqGetShapesByScopeAsString
FROM
subscription_scope ss,
scope s
WHERE
ss.subscription_id = @subscription_id
AND
ss.scope_id = s.id
ORDER BY
s.[name]
The function should be executed only once for each *returned* row in the SELECT, right? I believe that was the case in SQL 2k though I can't check it at the moment.
I've seen the iqGetShapesByScopeAsString is executed several times because I ran Profiler and noticed my cursor (my UDF uses a cursor) is opening and close the cursor a lot of times.

