Question : Linked servers

We have an environment setup here with dupication for development and staging.

Many sprocs exist within the database that use linked servers to get to other sql servers (which are also replicated for the various environments).

example:

in development a select must be issued to a linked server named devsql01.
i.e. [devsql01].[catalog].[table]
in production it must be issued to prodsql01.
i.e. [prodsql01].[catalog].[table]

This causes a huge amount of conflict due to the need to change the physical sprocs in order to change the names of the servers. My thought is to create a DNS based alias (lets call it SQL01) which is dev points to devsql01 and in production points to prodsql01. this way the link servers could use identical naming even though they are in different environments and thus they would not need to have changes to the sprocs

i.e. [Sql01].[Catalog].[Table]

Is there a better way of doing this? perhaps to alias the link server name within sql itself? I have done some quick searches and everything refers to the alias as the server name directly.

Cheers,

Greg

Answer : Linked servers

Maybe I missed something, but the linked server name you use in your queries is just a logical name. Can't you just create linked servers on your dev boxes with the name 'prodsql01', though in their connection strings they actually point at your dev server.

You could also use the  Client Network Utility. (in start menu or SQL bin folder)

Its got an alias tab which you can use to alias SQL servers. Its a client side utility so I guess you'd have to set it up on the actual dev box.
Random Solutions  
 
programming4us programming4us