Returns the name of the remote Microsoft® SQL Server™ database server as it appears in the login record.
@@REMSERVER
nvarchar(128)
@@REMSERVER enables a stored procedure to check the name of the database server from which the procedure is run.
This example creates a procedure, check_server, that returns the name of the remote server.
CREATE PROCEDURE check_server
AS
SELECT @@REMSERVER
The stored procedure is created on SEATTLE1, the local server. The user logs on to a remote server, LONDON2, and runs check_server.
exec SEATTLE1...check_server
Here is the result set:
---------------
LONDON2
Configuring Remote Servers | Configuration Functions |