Salim, usually the research question is "what is the prevalence of cognitive decline in patients with type 2 diabetes?" Below is a link to an article that provides mechanisms for cognitive decline and diabetes. The confounder to your question is age. Diabetes and cognitive decline are higher in the elderly. At the same time, adults 85 years and older are the fastest growing population. This article also provides a summary of representative prospective epidemiologic studies relating Type 2 diabetes (T2D) with dementia.
an association between T2DM and dementia has been made for some time. The Rotterdam Study (a community based population based study published in 1998) showed that a T2DM doubled the risk of dementia, with insulin treated patients having the highest risk. The Kungsholmen Project, another longitudinal, community based study, showed an adjusted hazard ratio of all types of dementia of 1.5 in patients with T2DM. There seems to be, though, as per other research, also a strong interaction of other factors, like arterial hypertension and dyslipidemia, or APO E variants, from other studies. A hsitory of severe hypoglycaemic episodes does increase the risk of dementia and as Lev pointed already out, Metformin and Sulfonylureas reduce the incidence.
Best wishes,
Immo
Alewijn Ott, Monique M.B. Breteler, Frans van Harskamp, Theo Stijnen, and Albert Hofman. Incidence and Risk of Dementia: The Rotterdam study. Am. J. Epidemiol. (1998) 147 (6): 574-580.
Xu WL, Qiu CX, Wahlin A, Winblad B, Fratiglioni L. Diabetes mellitus and risk of dementia in the Kungsholmen project. A 6-year follow-up study.
Neurology [2004, 63(7):1181-1186]
Rita Peila, Beatriz L. Rodriguez, and Lenore J. Launer. Type 2 Diabetes, APOE Gene, and the Risk for Dementia and Related Pathologies: The Honolulu-Asia Aging Study. Diabetes April 2002 51:4 1256-1262.
Hsu CC, Wahlqvist ML, Lee MS, Tsai HN. Incidence of dementia is increased in type 2 diabetes and reduced by the use of sulfonylureas and metformin. J Alzheimers Dis. 2011;24(3):485-93.
Haan, M. N., Mungas, D. M., Gonzalez, H. M., Ortiz, T. A., Acharya, A. and Jagust, W. J. (2003), Prevalence of Dementia in Older Latinos: The Influence of Type 2 Diabetes Mellitus, Stroke and Genetic Factors. Journal of the American Geriatrics Society, 51: 169–177.
Whitmer RA, Karter AJ, Yaffe K, Quesenberry CP, Selby JV. Hypoglycemic Episodes and Risk of Dementia in Older Patients With Type 2 Diabetes Mellitus. JAMA. 2009;301(15):1565-1572.
PS: If you do want to look at the incidence of diabetes in patients in dementia, I can recommend the article by Poblador-Plou B et al. : Poblador-Plou B, Calderón-Larrañaga A, Marta-Moreno J, et al. Comorbidity of dementia: a cross-sectional study of primary care older patients. BMC Psychiatry. 2014;14:84. doi:10.1186/1471-244X-14-84.