-
Notifications
You must be signed in to change notification settings - Fork 0
/
MengelolaPendaftaran.sql
50 lines (49 loc) · 1022 Bytes
/
MengelolaPendaftaran.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
create procedure MengelolaPendaftaran
@query varchar(50),
@statusAkhir varchar(50),
@idPendaftaran int,
@statusP varchar(50),
@idKegiatan int
as
if @query = 'Melihat'
begin
if @idKegiatan is null
begin
if @statusP is null
begin
select *
from Pendaftaran
end
else
begin
select *
from Pendaftaran
where statusP = @statusP
end
end
else
begin
if @statusP is null
begin
select *
from Pendaftaran
where IdKegiatan = @idKegiatan
end
else
begin
select *
from Pendaftaran
where IdKegiatan = @idKegiatan and statusP = @statusP
end
end
end
else if @query = 'Mengelola'
begin
if (select statusP from Pendaftaran where IdP = @idPendaftaran) = 'Menunggu Konfirmasi'
begin
update Pendaftaran set statusP = @statusAkhir where IdP = @idPendaftaran
end
end
exec MengelolaPendaftaran 'Melihat',null, null, 'Diterima',1
exec MengelolaPendaftaran 'Mengelola', 'Diterima', 91, null, null
select * from Pendaftaran where idm=51