Home > SQL Server > @@RemServer – SQL Server

@@RemServer – SQL Server


@@RemServer: this function returns the name of the remote SQL server name using stored procedure. It enables a stored procedure to check the name of the database server from which the procedure is run.

Implementation

I have created a stored procedure in Dev1a server as shown below.

pic1If we execute this stored procedure locally it will return null. Because, The value of the remserver function to the local server is null.

pic2if we execute this procedure with server name it returns the remote server name.

pic3Microsoft said that this function will be removed in the future version of SQL Server. So, we have to use linked server in the new application development.

Learn more about Remote server and Linked Server.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: