Sigh ok, something is really broken because this was working before we failed over.
The code for the login replication basically does the following via a cursor (yeah, I know, but it works…normally):
1. Select from the primary via
OPENQUERYto query the logins and passwords
varbinarypassword to a
3. Create a string to be executed, i.e. dynamic SQL that runs a
Read on for the whole story and how you can protect yourself as you upgrade to SQL Server 2019.