In this nationwide population-based cohort study, we found that SGLT2 inhibitors were associated with a lower risk of the composite outcome of hospitalization for HF or mortality compared to DPP4 inhibitors in patients with both type 2 diabetes and AF. Here, SLC5A2 is linked to type 2 diabetes mellitus.