AIM: We aimed to investigate whether sodium-glucose cotransporter-2 inhibitors (SGLT2is) are associated with a decreased risk of gastrointestinal (GI) cancers in patients with type 2 diabetes (T2D) compared to other glucose lowering medications (oGLMs). METHODS: This active-comparator, new-user cohort study used the nationwide National Health Insurance Service database of the Republic of Korea from September 2014 to June 2020. From 79,423 new users of SGLT2is and 294,707 new users of oGLMs, we used a propensity score to match 59,954 from each of these two treatment groups. We calculated hazard ratios (HRs) and 95 % confidence intervals (CIs) for the incidence of GI cancers, encompassing stomach, colorectal, liver, and pancreatic cancers. RESULTS: During the observation period, there were 814 and 916 GI cancers, and 794 and 1,140 deaths in the SGLT2is and oGLMs treatment groups, respectively. The use of SGLT2is was associated with a statistically significant reduction in the incidence of GI cancers, with an adjusted HR of 0.90 (95 % CI: 0.82 to 0.99). However, only the incidence of pancreatic cancer was significantly lower in SGLT2is users compared to non-users, with an adjusted HR of 0.72 (95 % CI: 0.55 - 0.95). In the entire cohort, the multivariable-adjusted HR for pancreatic cancer was 0.70 (95 % CI: 0.56 to 0.88). CONCLUSION: For T2D patients, SGLT2i use was associated with a diminished pancreatic cancer risk compared to oGLMs. Future studies should ascertain the potential protective effect of SGLT2is against pancreatic cancer.