We've got a server upgrade scheduled for the near-future and we're looking to move to a new server. Our main issue is that we cannot have two servers with the same name on our domain. So is there a command which corrects all of my connections to '08Server1' from '08Server2' to instead use '16Server1' from '16Server2'?

All our applications also reference '08Serverx' - other than a mass find&replace - is there a better method available?

  • Perhaps this will help - Using DNS aliases to manage database connections Oct 3 '18 at 10:48
  • It sounds like the code that the developers developed always points to the same (Production) Server. That doesn't sound right. Oct 3 '18 at 13:01
  • Michael Kutz I'm a little confused. The developers work on 4 sites hosted across 2 servers. Supposedly it'll take weeks to correct all of the paths pointed at our database servers foo - unless we find a method for using the same server name foo\sqlInstanceBar. Oct 3 '18 at 13:18
  • 1
    @BradleyBarfoot - Going from foo\sqlDevelopmentInstance to bar\sqlProductionInstance should be a simple config change. If the code has the connection hard coded to use bar\sqlProductionInstance, than (from what I see) developers are writing/testing code against the Production database. This is an extremely bad practice. Even in a small 1 - 4 developer shop, we used config files to go from Dev to Prod. Why did they hardcode a connection value? Why are they not spending the time to change it to use a config file? Oct 3 '18 at 14:05
  • A large quantity of our stored procedures are cross-server and include transactional replication. In order to minimise work-load for the devs I'm trying to help in that regard. Oct 3 '18 at 16:04

For our system we set up a DNS Alias and have all the connection strings point at that i.e. sqlSERVERAlias\Database where SQLSERVERAlias points at 08Serverx or 08Servery

Then all you've got to do is change the Alias when you change the servers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.