To assess the real-world cardiovascular (CV) safety for sulfonylureas (SU), in comparison with dipeptidylpeptidase-4 inhibitors (DPP4i) and thiazolidinediones (TZD), through development of robust methodology for causal inference in a whole nation study. A cohort study was performed including people with type 2 diabetes diagnosed in Scotland before 31 December 2017, who failed to reach HbA1c 48 mmol/mol despite metformin monotherapy and initiated second-line pharmacotherapy (SU/DPP4i/TZD) on or after 1 January 2010. The primary outcome was composite major adverse cardiovascular events (MACE), including hospitalization for myocardial infarction, ischemic stroke, heart failure, and CV death. Secondary outcomes were each individual end point and all-cause death. Multivariable Cox proportional hazards regression and an instrumental variable (IV) approach were used to control confounding in a similar way to the randomization process in a randomized control trial. Comparing SU to non-SU (DPP4i/TZD), the hazard ratio (HR) for MACE was 1.00 (95% CI: 0.91-1.09) from the multivariable Cox regression and 1.02 (0.91-1.13) and 1.03 (0.91-1.16) using two different IVs. For all-cause death, the HR from Cox regression and the two IV analyses was 1.03 (0.94-1.13), 1.04 (0.93-1.17), and 1.03 (0.90-1.17). Our findings contribute to the understanding that second-line SU for glucose lowering are unlikely to increase CV risk or all-cause mortality. Given their potent efficacy, microvascular benefits, cost effectiveness, and widespread use, this study supports that SU should remain a part of the global diabetes treatment portfolio.