开发者

T-SQL cross server function execution -Is there a configuration in SQL server to execute functions cross servers?

开发者 https://www.devze.com 2023-02-11 11:52 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消