SELECT
UsrAct_Guid as Kayit_ID
,UsrAct_year as Yil
,dbo.fn_YilAyTr(UsrAct_login_date) as Ay
,User_no as Kullanici_No
,User_name as Kullanici_Ismi
,User_LongName as Kullanici_Uzun_Ismi
,UsrAct_login_date AS Giris_Zamani
,CASE WHEN YEAR(UsrAct_logout_date) < 2000 THEN NULL ELSE UsrAct_logout_date END AS Cikis_Zamani
,CASE WHEN YEAR(UsrAct_logout_date) < 2000 THEN DATEDIFF(MINUTE, UsrAct_login_date, GETDATE()) ELSE DATEDIFF(MINUTE, UsrAct_login_date, UsrAct_logout_date) END AS Kullanim_Dakikasi
,UsrAct_DBase as Database_Kod
,VT.DB_isim as Database_Adi
,UsrAct_IP as Kullanici_IP_Adresi
,UsrAct_Domain as Kullanici_Domain_Adresi
,UsrAct_PC as Kullanici_PC_Ismi
,UsrAct_Program AS Program_Adi
, UsrAct_AktifVersiyon AS Program_Versiyonu
,UsrAct_RecInsert + UsrAct_VchrNew as Islem_YeniKayit_Adedi
, UsrAct_RecDelete + UsrAct_VchrDelete as Islem_Silme_Adedi
, UsrAct_RecUpdate + UsrAct_VchrUpdate as Islem_EvrakKayitDegistirme_Adedi
, UsrAct_Menuno as Programda_Giris_Yaptigi_MenuNo
,case when UsrAct_Menuno ='999999011' then 'Ana Menu_ İlk Giris Ekrani ' else
UsrAct_AgacStr1 + ' _ ' + UsrAct_AgacStr2 + ' _ ' + UsrAct_AgacStr3 + ' _ ' + UsrAct_AgacStr4 + ' _ ' +
UsrAct_AgacStr5 + ' _ ' + UsrAct_AgacStr6 + ' _ ' + UsrAct_AgacStr7 + ' _ ' + UsrAct_AgacStr8 + ' _ ' + UsrAct_AgacStr9 + ' _ ' +
UsrAct_AgacStr10 end as Programda_Giris_Yaptigi_MenuYolu
FROM MikroDB_V16.dbo.KULLANICI_AKSIYONLARI
INNER JOIN MikroDB_V16.dbo.KULLANICILAR ON UsrAct_no = User_no
INNER JOIN MikroDB_V16.dbo.VERI_TABANLARI VT ON DB_kod = UsrAct_DBase
------------------where UsrAct_DBase='ABC' /* Database Seciniz */
ORDER BY UsrAct_login_date DESC