Jobin Joseph Jobin Joseph - 1 year ago 63
SQL Question

Connecting to different servers in SQL Server

Scenario- We have more than 100 stores and each store has a server. I've created one application to install each users desktop. Their system needs to be connected with their store server, we have local database in place with the application which has procedures which will be interacting with the server. I can't hard code the server name in each procedures and in the SQL, Using DBLink didn't work.

What is the best way to achieve this?

Answer Source

Your app can list any available sql servers on the network if there is only one then connect to it. If more than one put a dialog up to the users to confirm.

You can use:

sqlcmd -L 

That will return any visible sql servers