Welcome  |  Sign In     | 
MSDN
     
Transact-SQL Reference
@@REMSERVER
Transact-SQL Reference
@@REMSERVER

Returns the name of the remote Microsoft® SQL Server™ database server as it appears in the login record.

Syntax

@@REMSERVER

Return Types

nvarchar(256)

Remarks

@@REMSERVER enables a stored procedure to check the name of the database server from which the procedure is run.

Examples

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

See Also

Configuration Functions

Configuring Remote Servers


©2007 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
 
Page view tracker