Infections are a major clinical challenge for type 2 diabetes patients, but little is known about the impact of glycemic control. We used Cox regression analyses to examine the association between baseline and time-varying hemoglobin A(1c) (HbA(1c)) values and development of community antiinfective-agent-treated and hospital-treated infections in 69,318 patients with type 2 diabetes diagnosed between 2000 and 2012 in Northern Denmark. Incidence rates were 394/1,000 patient-years for community-treated infections and 63/1,000 patient-years for hospital-treated infections. The adjusted hazard ratios for community-treated infection at an HbA(1c) level of >= 10.50%, as compared with 5.50%-< 6.49%, were 0.97 (95% confidence interval (CI): 0.94, 1.00) for HbA(1c) measured at early baseline, 1.09 (95% CI: 1.03, 1.14) for updated mean HbA(1c), 1.13 (95% CI: 1.08, 1.19) for updated time-weighted mean HbA(1c), and 1.19 (95% CI: 1.14, 1.26) for the latest updated HbA(1c). Corresponding estimates for hospital-treated infections were 1.08 (95% CI: 1.02, 1.14) for early baseline HbA(1c), 1.55 (95% CI: 1.42, 1.71) for updated mean HbA(1c), 1.58 (95% CI: 1.44, 1.72) for updated time-weighted mean HbA(1c), and 1.64 (95% CI: 1.51, 1.79) for the latest updated HbA(1c). Our findings provide evidence for an association between current hyperglycemia and infection risk in type 2 diabetes patients.