I need to create a LEFT JOIN with another server in SQL Server, and the information to what the server would be is inside table Servidor. So, I've tried to use the s.dns and s.banco as the information for the linked server information, but it doesn't work that way. Is there any way I'd be able to set s.dns and s.banco dynamically like my snippet?
INNER JOIN
[Server].[dbo].[Servidor] s ON cli.idServidor = s.idServidor
LEFT JOIN
[s.dns].[cli.banco].[dbo].[RecepcaoModulo] rm
ON r.codigo_modulo = rm.codigo
AND r.latitude = rm.latitude
AND r.longitude = rm.longitude
AND MAX(rm.TimeStampModulo)