Calling a stored procedure on data in a linked server

  • I'm trying to call a stored procedure from an ASP.net web app, but the data is in a linked server in SQL Server 2000, not in one of the databases.  I can see how to set up and call stored procedures in regular databases, but I don't see how to do it against data in a linked server.  Where do you create the stored procedure?  I'm not seeing an option in the linked server menus.  Thanks in advance!

  • Create the stored procedure on the server where the linked server is created. Access all the data from the linked server in the stored procedure. Call the stored procedure from asp.net.

    If I have understood your question correctly this should do the trick.

    Yash 

     

     

  • Where do I create it on the server though?  I can see how to create them within each database that resides on a particular server, but wouldn't these only be able to access data within that database?  In the menu tree, I don't see an option for creating a stored procedure on the linked server.

  • A stored procedure can query data in databases other than the database it exists in, via 3 part naming (DBName.DBOwner.TableName) or on linked servers via 4 part naming.

     

    CREATE PROCEDURE TestProc

    As

    BEGIN

       SELECT * FROM SomeOtherDB.dbo.YourTable

    END

     

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

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