Tuesday, February 21, 2012

Giving alias name or different name to Linked Server in MS SQL

Today I would like to put sometime on giving alias named to Linked Server. I got some request to update the linked server name from Server_ABC to Server_XYZ. It sounds pretty simple to update the name but I came to know the real depth in it when I tried to find the dependencies. There are many dependencies for this linked server and most of the cases I found it in Store Procedures. So, I have to update the linked server name at all the places to reflect the change. In Order to get rid of this, we can make use of alias concept where we keep the linked server name to be more generic and pointing the data source points to original server name.

Follow these settings to create an alias name for linked server:

Right click on the target linked server and Properties
General Tab -
Linked Server: generic name
Server Type: choose other data source
Provider: SQL Native Client
Product: sql_server
DataSource: original server name

Security Tab - choose the appropriate security context
If you are connecting to a remote server,  click Be made using this security context and enter sql login credentials to connect to the linked server.

Server Options -
Collation Compatible: false
Data Access - True
Rpc - True
Rpc Out - True
Use Remote Collation - True
Connection Timeout & Query Timeout are by default set to 0 which is unlimited. Any value specified greater than 0 is treated in seconds.

This alias name helps us more when we work on the linked servers in both dev and production environment. We can make use of this alias concept to maintain same linked server name on both the environments.


Hope this helps!

No comments:

Post a Comment