-Umzug der Anmeldedaten auf einen neuen SQL Server / Moving the credentials to a new SQL Server (Microsoft TSQL)

Das Skript speichert alle Anmeldedaten in einer (lokalen) Datenbank. In einem zweiten Schritt können diese Daten wieder in einen neuen Server eingelesen werden. Die Anmeldedaten aus dem alten Server können auch über eine Linked-Serververbindung in den neuen Server eingelesen werden.

English:
The script stores all credentials in a (local) database. In a second step, this data can be read into a new server again. The credentials from the old server can also be read into the new server via a linked server connection.

Save the credentials:

[pastacode lang=“sql“ manual=“DECLARE%20%40UserDb%20VARCHAR(200)%20%3D%20’databaseForTheLogindata‘–Database%20in%20which%20the%20data%20is%20stored%0ADECLARE%20%40SaveToUserDb%20BIT%20%3D%201%09%09%09%09%09%09%09–%201-%3E%20save%20the%20data%20in%20the%20local%20database%20%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09–%200-%3E%20Reading%20the%20data%20from%20a%20local%20database%20and%20storing%20in%20the%20server%0A%0A–If%20no%20value%20was%20entered%2C%20then%20the%20data%20are%20stored%20in%20the%20local%20database%0ADECLARE%09%40PartnerServer%20sysname%20%3D%20“%0A–When%20debug%20is%20turned%20on%2C%20no%20data%20are%20written%20to%20the%20server%20but%20only%20as%20output%20text.%0ADECLARE%20%40Debug%20bit%20%3D%201″ message=“Save the credentials in the database“ highlight=““ provider=“manual“/]

In the second step the credentials are transferred from the database to the new server:

[pastacode lang=“sql“ manual=“DECLARE%20%40UserDb%20VARCHAR(200)%20%3D%20’databaseForTheLogindata‘–Database%20in%20which%20the%20data%20is%20stored%0ADECLARE%20%40SaveToUserDb%20BIT%20%3D%200%09%09%09%09%09%09%09–%201-%3E%20save%20the%20data%20in%20the%20local%20database%20%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09–%200-%3E%20Reading%20the%20data%20from%20a%20local%20database%20and%20storing%20in%20the%20server%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%0A–If%20no%20value%20was%20entered%2C%20then%20the%20data%20are%20stored%20in%20the%20local%20database%0ADECLARE%09%40PartnerServer%20sysname%20%3D%20’NameOfTheLinkedServer’%0A–When%20debug%20is%20turned%20on%2C%20no%20data%20are%20written%20to%20the%20server%20but%20only%20as%20output%20text.%0ADECLARE%20%40Debug%20bit%20%3D%201″ message=“Transfer credentials to the new server“ highlight=““ provider=“manual“/]

Code on github
Code on GitHub