Executing a Stored Procedure Via a Linked Server

It is possible to execute a stored procedure via a linked server. The server that is hosting the client connection will accept the client's request and send it to the linked server. The EXECUTE statement must contain the name of the linked server as part of its syntax:

EXECUTE servername.dbname.owner.procedure_name
					

This example executes sp_helpsrvrole on SWServer, which shows a list of available fixed server roles on the 'SWServer' remote server:

EXEC SWServer.master.dbo.sp_helpsrvrole 

Get Microsoft® SQL Server™ 2000 Unleashed, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.