Home Forums SQL Server 2005 T-SQL (SS2K5) Calling a stored procedure from within a function RE: Calling a stored procedure from within a function

  • i have the same problem. i need to call a sp in a udf.

    this is the function i wrote on your example:

    CREATE FUNCTION dbo.c_sel_produs_comF_f
    (@furnizor char(14), @data_doc smalldatetime, @tip char(1))
    RETURNS TABLE
    AS
    RETURN
    (SELECT * FROM openquery('SERVER', 'exec dbo.c_sel_produs_comF @furnizor, @data_doc, @tip'))

     

    edit: there is something else: OPENQUERY does not accept variables for its arguments