🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / MSSQL RMOS / örnek procedür

1-) MSSQL RMOS - örnek procedür

 

 

create proc talepRapor(@tip int) as begin

-- select *   from tblTalep

-- exec talepRapor 1

 

-- Bildiren kullanıcıya göre

if @tip=1 begin

select

--fldDurum as durum,

Count(fldTalepId) as toplamTalep,

fldKullaniciAdi from tblTalep

--where fldTarih between '2010-9-01' and '2019-11-30'

--and fldDurum=1

group by fldKullaniciAdi

--,fldDurum

end

 

-- Bildiren deparmana göre

else if @tip=2 begin

select

--fldDurum as durum,

Count(fldTalepId) as toplamTalep,

fldDepartman from tblTalep

--where fldTarih between '2010-9-01' and '2019-11-30'

--and fldDurum=1  

group by fldDepartman

--,fldDurum

end

 

else if @tip=3 begin

-- cevaplayan personele göre

select

p.fldPersonelAdi,

--fldDurum as durum,

Count(fldTalepId) as toplamTalep,

t.fldPersonelId from tblTalep as t ,tblPersonel as p

where

--fldTarih between '2010-9-01' and '2019-11-30' and

--fldDurum=1 and

 p.fldPersonelId<>0 and p.fldPersonelId=t.fldPersonelId

group by t.fldPersonelId

--,fldDurum

,p.fldPersonelAdi

end

 

else if @tip=4 begin

-- bildiren otele göre

select

fldOtel,

--fldDurum as durum,

Count(fldTalepId) as toplamTalep

from tblTalep as p

--where fldTarih between '2010-9-01' and '2019-11-30'

 

-- and fldDurum=1

group by fldOtel

--,fldDurum

end

 

end

 2021 Ocak 18 Pazartesi
 399