UDF on a Linked Server

  • Is there a strait-forward way to call a UDF on a linked server? The following statement does not work:

    select * from server_name.database_name.dbo.udf_name( 1 )

    However the same statement without the server name works fine:

    select * from database_name.dbo.udf_name( 1 )

    If it is not possible to specify the server name here, what is the logical reasoning for it?

    Thank you.

    Michael

  • Have you tried to use openquery to call function in linked SQL Server.

    For example,

    select * from OPENQUERY(TSTSQL01,'select * from master.dbo.usysprocess(51)')

  • Allen, you are right. It works that way. Thank you.

  • I just wonder if using UDF is better than using a SP on the linked server. The SP would return a rowset, of course, that would be inserted into a local temp table. OR use a UDF and still insert into a local temp temp for further usage.

    So, does anyone have experience of comparing performance of these approaches?

    Thank you.

    Michael

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply