Frage

I would like to connect to multiple servers using Linked Server do download table and do queries. I want to store server IP in a table and go down the list using CURSOR to connect to each. I would like to store the password on the table as well but I don't know if this is bad idea. Is this ok or what is better alternative?

Is there a version of sp_addlinkedsrvlogin that doesn't need password..?

War es hilfreich?

Lösung

It's definitely a bad practice and a bad idea to store any kind of passwords in plain text in the database, let alone the specific passwords for access to your other servers. Database servers are frequent targets of attacks, and storing your password in an unobfuscated and unencrypted manor makes them so much easier of a target.

I've seen a couple of your questions on here, and it makes me think that you'd best be served by centralizing your data into one server. A couple options to do that you can look into are Replication and SSIS. (AlwaysOn Availability Groups is another feature you can use to synchronize data across servers as well, but might be overkill for your use cases.)

Otherwise if you want to continue to query through Linked Servers you should only have to set them up once on your primary server, and not need to store or use the password to access them. You can follow either this guide or the Microsoft Docs on how to setup a Linked Server appropriately.

After they're setup, you can access entities from them using the four part naming scheme like so: SELECT SomeField FROM LinkedServerName.DatabaseName.SchemaName.TableName

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit dba.stackexchange
scroll top