Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Calling a function.

Author  Topic 

somu_p
Starting Member

13 Posts

Posted - 2008-02-26 : 08:54:46
I'm calling a function with its full qualifiers.
That means servername.dbname.schemaname.functionname

I'm getting an error like this
Invalid column name 'servername'.

Is it possible to call a function name with its server name?


Thanks
Somu

ranganath
Posting Yak Master

209 Posts

Posted - 2008-02-26 : 09:02:03
Hi,

CREATE FUNCTION fx_SumTwoValues
( @Val1 int, @Val2 int )
RETURNS int
AS
BEGIN
RETURN (@Val1+@Val2)
END

SELECT dbo.fx_SumTwoValues(1,2) AS SumOfTwoValues
Go to Top of Page

somu_p
Starting Member

13 Posts

Posted - 2008-02-26 : 09:46:32
No. I want to call the function name with its server name.

ex: Server.DB.Schema.functionName()
Go to Top of Page

talleyrand
Starting Member

35 Posts

Posted - 2008-02-26 : 10:08:11
I had never tried it but I get the same results--invalid column name 'server' Which is interesting as I can do SELECT TOP 1 * FROM server.db.schema.table no problem so it's not a question of whether I can use the database remotely. I then repeated with calling a table value function on a different server
SELECT * FROM Server.DB.Schema.TableValueFunction('2008-01-01') and it failed out with
Remote table-valued function calls are not allowed.
Makes me wish I had an aggregate function to see what error message it returns when it's invoked remotely.

Executing a stored procedure through a remote server works just fine. Interesting, interesting, I'll have to check BOL over lunch to see if I can understand why it is so.
Go to Top of Page

hamtek
Starting Member

1 Post

Posted - 2008-02-27 : 06:39:20
Hi.
Perhaps you could call a remote stored procedure which could then call and return results from the remote function?
I know its not the perfect solution, but hope it gives you an idea :)
Go to Top of Page
   

- Advertisement -