Using/Creating an alias for SQL Server 2005

Scenarios of Use:

  1. We may want to redirect the connection of an existing application to a different database server without modifying the connection string which might be needed if the database has been moved to a different server and previously used server is no more there.
  2. We don’t want to expose the actual server name but will offer the alias of that server to connect to.
  3. There are some applications which do not allow to specify the named instance for its connection. In that case we can specify an alias for that servername\instancename.

Creating an alias:

Open up the SQL Server Configuration Manager (Start->Programs->Microsoft SQL Server 2005->Configuration Tools). In the left pane expand SQL Native Client Configurations, right click on Aliases and click on New alias.

12341

 

 

 

 

 

 

 

Window for setting up a new alias will be opened up.

In the Alias Name field specify the desired name of the alias, in Server field specify the name of the server (along with the instance name if it is not default instance), specfiy the port like 1433 or just leave this field blank.

12345

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Click OK. This will create a new alias for your SQL server instance.

Connecting using Alias:

This created alias can be referred in any connection string, while connecting directly through management studio and also in the SQL Server Agent to connect to server using alias.

Note: There is no need to restart the sql service to make this alias active.

Advertisements
This entry was posted in SQL Server. Bookmark the permalink.

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