Linked server problem

  • I've defined the linked server and I can select from the remote tables, but I get an "invalid column name" error on the linked server name when I perform a function call from the linked server.

    any suggestion please

  • show us your function call;

    here's an example of using a linked server to get a function call back, does this help?

    exec ServerName.master.dbo.sp_executesql N'Select SERVERPROPERTY(''MachineName'')'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (7/28/2009)


    show us your function call;

    here's an example of using a linked server to get a function call back, does this help?

    exec ServerName.master.dbo.sp_executesql N'Select SERVERPROPERTY(''MachineName'')'

    select [LINKEDSERVER1].DB.dbo.T_DATE('D')

    this run the function named T_DATE on remote DATABASE DB

    it give error invalid column name LINKEDSERVER1

    I need those function and more from the server to be included in queries

  • ali.m.habib (7/28/2009)


    Lowell (7/28/2009)


    show us your function call;

    here's an example of using a linked server to get a function call back, does this help?

    exec ServerName.master.dbo.sp_executesql N'Select SERVERPROPERTY(''MachineName'')'

    select [LINKEDSERVER1].DB.dbo.T_DATE('D')

    this run the function named T_DATE on remote DATABASE DB

    it give error invalid column name LINKEDSERVER1

    I need those function and more from the server to be included in queries

    Looking at your code your trying to use LinkedServer the wrong way. (T_DATE looks like a scalar funtion)

    LinkedServer is about distributed queries and a rowset is expected from the linked server

    SELECT * FROM OPENQUERY(LINKEDSERVER1,'SELECT dbo.T_DATE(''D'')')

    should work


    Kindest Regards,

    Vasc

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply