I have a user-defined function that needs to return a table. The select statement must be dynamic. How do I accomplish this? (this udf is used from another stored procedure)
The dynamic query selects records from a third-party database (Jet, as a linked server, whose name is dynamic).
I have SQL Server 2000. Here's what I've got so far:
ALTER FUNCTION dbo.qryCustomerGeneralArtGroupRebates
-- cannot EXEC inside a function, either :-(