February 25, 2008 at 4:48 am
Hello,
How can I call UDFs on linked servers in SQL Server 2005?
More details:
I have some UDFs on Instance "VAXP\ServerA" in Database "DB1", for example "getSomething(number)".
It might look like this (for example):
----
CREATE FUNCTION [dbo].[getSomething] (
@theNumber int
)
RETURNS int AS
BEGIN
DECLARE @result int
SET @result = theNumber * 5
RETURN @result
END
----
I can call this function inside of the DB by typing:
----
SELECT dbo.getSomething(5)
----
I also can call the function from another DB on instance "ServerA" by typing:
----
SELECT DB1.dbo.getSomething(5)
----
I have a second instance called "VAXP\ServerB", and "VAXP\ServerA" is a linked server in "VAXP\ServerB". I can do selects and stuff, it works fine.
But when I want to call the function...
----
SELECT [VAXP\ServerA].DB1.dbo.getSomething(5)
----
I obtain the next error:
Msg. 207, Level 16, State 1, Line 1
The name of the column 'VAXP\ServerA' is not valid.
Any hint?
Thanks in advance
David
February 25, 2008 at 8:23 pm
execute ('select DB1.dbo.getSomething(3)')
as login = 'MyLoginName'
at LinkedServerName
You can use login or user names. See BOL under EXECUTE (Transact-SQL).
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply