-- Actualizar el valor del  usuario de Te-sis obteniendo el ID del traspaso de Te-sis
UPDATE A
SET A.UseID_FC = B.ColID,
A.UseID_FM = B.UseID
FROM asurnet.dbo.CARTAS A
INNER JOIN (
	SELECT A.CRT_Id, B.IDTSS AS ColID, C.IDTSS AS UseID
	FROM asurnet.dbo.CARTAS A
	LEFT JOIN tssseg0001.dbo.IDTraspasos B
	ON A.USR_Id_FC = B.IDTras AND B.TableID = 'Usuarios'
    INNER JOIN tssseg0001.dbo.IDTraspasos C
    ON A.USR_Id_FM = C.IDTras AND C.TableID = 'Usuarios'
) B ON A.CRT_Id = B.CRT_Id