T-SQL cross server function execution -Is there a configuration in SQL server to execute functions cross servers?
I have a function in [MHL1P].[x].dbo.udf_Admin_GetNameByID(t3.StaffID)
I want to execute this function from another server in a store procedure like this:
select [MHL1P].[x].dbo.udf_Admin_GetNameByID(StaffID)
from StaffIdTable
Is there a configuration in SQL server to execute开发者_StackOverflow社区 functions cross servers?
Look at sp_addlinkedserver
Note that this is usually a bad idea, as certain things don't work as well on linked servers (the query optimizer doesn't have good information about statistics or indexes, for example).
Assuming you have a linked server you may need to use OPENQUERY to call a UDF as this article suggests.
I'm not sure if they fixed this in 2005 or 2008.
精彩评论