SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Calling a function.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

somu_p
Starting Member

13 Posts

Posted - 02/26/2008 :  08:54:46  Show Profile  Reply with Quote
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 - 02/26/2008 :  09:02:03  Show Profile  Reply with Quote
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 - 02/26/2008 :  09:46:32  Show Profile  Reply with Quote
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

USA
35 Posts

Posted - 02/26/2008 :  10:08:11  Show Profile  Visit talleyrand's Homepage  Click to see talleyrand's MSN Messenger address  Send talleyrand a Yahoo! Message  Reply with Quote
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

United Kingdom
1 Posts

Posted - 02/27/2008 :  06:39:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000