Sodium-glucose transporter 2 (SGLT2) inhibitors are new glucose-lowering agents that have been proven to be beneficial for patients with cardiovascular diseases, heart failure, and sudden cardiac death. However, the possible protective effects of cardiac arrhythmia have not yet been clarified in clinical practice. In this study, we attempted to demonstrate the effects of SGLT2 inhibitors on cardiac arrhythmia by medical records from a single center. This retrospective study included patients diagnosed with type 2 diabetes mellitus (DM) and controlled hypertension who prescribed the indicated glucose-lowering agents based on medical records from 2016 to 2019 from Kaohsiung Medical University Hospital. These patients were divided into two groups. Group one patients were defined as patients with SGLT2 inhibitor therapy, and group two patients were defined as patients without SGLT2 inhibitor therapy. Baseline characteristics were collected from medical records. Univariate, multivariate, and match-paired statistical analyses were performed for the study endpoints. The primary study outcome was the incidence of cardiac arrhythmias, including atrial and ventricular arrhythmias, after SGLT2 inhibitor therapy. The secondary study outcomes were the incidence of stroke, heart failure, and myocardial infarction after SGLT2 inhibitor therapy. From the initial 62,704 medical records, a total of 9609 people who met our experimental design criteria were included. The mean follow-up period was 51.50 ± 4.23 months. Group one included 3203 patients who received SGLT2 inhibitors for treatment, and group two included 6406 patients who received non-SGLT2 inhibitors for treatment. Multivariate analysis showed that group one patients had significantly lower incidences of total cardiac arrhythmia (hazard ratio (HR): 0.58, 95% confidence interval (CI): 0.38–0.89, p = 0.013) and atrial fibrillation (HR: 0.56, 95% CI: 0.35–0.88, p = 0.013) than those of group two patients. The secondary outcome analysis showed that group one patients also had a significantly lower risk of stroke (HR: 0.48, 95% CI: 0.33–0.7; p < 0.001), heart failure (HR: 0.54, 95% CI: 0.41–0.7, p < 0.001), and myocardial infarction (HR: 0.47, 95% CI: 0.31–0.72, p < 0.001). A time-to-event analysis showed that treatment of type 2 DM patients with SGLT2 inhibitors could reduce the probability of total cardiac arrhythmia and related cardiovascular disease, such as atrial fibrillation, stroke, heart failure, or myocardial infarction, by 0.5%~0.8%. This databank analysis showed that SGLT2 inhibitor therapy reduced the incidence of total cardiac arrhythmia and atrial fibrillation in type 2 DM patients and decreased the incidence of related cardiovascular diseases, such as stroke, heart failure, and myocardial infarction. However, additional investigations are needed to confirm this hypothesis.