Hello!
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
(
)
(
ArtikelNr nvarchar(50),
Artikelgrupp int
)
AS BEGIN
-- cannot EXEC inside a function, either :-(
RETURN
END