Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

@@REMSERVER (Transact-SQL)

Important noteImportant

This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use linked servers and linked server stored procedures instead.

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

Topic link iconTransact-SQL Syntax Conventions



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

The following example creates the procedure usp_CheckServer that returns the name of the remote server.


The following stored procedure is created on the local server SEATTLE1. The user logs on to a remote server, LONDON2, and runs usp_CheckServer.

EXEC SEATTLE1...usp_CheckServer

Here is the result set.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft