1

I want to use a table-valued database function in the where clause of a query I am building using LLBLGen Pro 2.6 (self-servicing).

SELECT * FROM [dbo].[Users]
WHERE [dbo].[Users].[UserID] IN (
SELECT UserID FROM [dbo].[GetScopedUsers] (@ScopedUserID)
)

I am looking into the FieldCompareSetPredicate class, but can't for the life of me figure out what the exact signature would be. Any help would be greatly appreciated.

ADDITION - A better question would be "How do can you interact with a table-valued function via LLBLGen Pro?" I do not see how to generate files/classes for it.

Dan Appleyard
  • 7,405
  • 14
  • 49
  • 80

1 Answers1

0

Yes. Use DbFunctioncallExpression, to formulate an expression with a DbFunctionCall and then use a FieldCompareExpression predicate to use it. See 'Calling a Database Function' in ... the manual! :) http://www.llblgen.com/documentation/3.0/LLBLGen%20Pro%20RTF/hh_goto.htm#Using%20the%20generated%20code/gencode_dbfunctioncall.htm

Please post questions on our forums, it's easier to track them down :)

Frans Bouma
  • 8,259
  • 1
  • 27
  • 28
  • That documentation on talks about scalar functions, not functions that return a table. I had earlier looked at this and tried it, but it did not work. – Dan Appleyard Dec 22 '10 at 22:18
  • Oh sorry, I missed that important aspect! Indeed, this is a feature that's not supported out of the box. You can add it yourself in this particular case, by using the sourcecode of FieldCompareSetPredicate (it's in the runtime library sourcecode) and rewrite it to generate the kind of predicate you want. – Frans Bouma Dec 23 '10 at 08:45