Answered exec remote sp

  • Saturday, November 17, 2012 6:15 PM
     
     
    I am having trouble executing a stored procedure on a remote server. On my 
    local server, I have a linked server setup as follows:
            Server1.abcd.myserver.com\SQLServer2005,1563

    This works fine on my local server:

    Select * From [Server1.abcd.myserver.com\SQLServer2005,1563].DatabaseName.dbo.TableName

    This does not work (Attempting to execute a remote stored proc named 'Data_Add':

    Exec [Server1.abcd.myserver.com\SQLServer2005,1563].DatabaseName.Data_Add 1,'Hello Moto'

    When I attempt to run the above, I get the following error:
    Could not locate entry in sysdatabases for database 'Server1.abcd.myserver.com\SQLServer2005,1563'.
            No entry found with that name. Make sure that the name is entered correctly.


    Could anyone shed some light on what I need to do to get this to work?

All Replies

  • Saturday, November 17, 2012 11:04 PM
    Moderator
     
     Answered Has Code

    With 3-part names, the first name part is interpreted as a database name instead of a server name.  Try adding the schema name (dbo) before the stored procedure name:

    EXEC [Server1.abcd.myserver.com\SQLServer2005,1563].DatabaseName.dbo.Data_Add 1,'Hello Moto';


    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/