Amigo poderia explicar como faço para adicionar as JOBS 1 e 2 nao estou conseguindo !
Tentei rodar elas mais esta dando erro poderia dar uma força obrigado !
===============================================================================================
JOB 1 - TOP REI DO MU
===============================================================================================
declare
@name varchar(10),
@acc varchar(10),
@num int,
@g1 varchar(10),
@g2 varchar(10),
@g3 varchar(10),
@gm1 varchar(10),
@gm2 varchar(10),
@gm3 varchar(10)
set @num = 0
set @g1 = (select top 1 g_name from guild order by owner_time desc)
set @g2 = (select top 1 g_name from guild where g_name <> @g1 order by owner_time desc)
set @g3 = (select top 1 g_name from guild where g_name <> @g1 and g_name <> @g2 order by owner_time desc)
set @gm1 = (select top 1 accountid from character where name=(select top 1 g_master from guild order by owner_time desc) collate database_default)
set @gm2 = (select top 1 accountid from character where name=(select top 1 g_master from guild where g_name <> @g1 order by owner_time desc) collate database_default)
set @gm3 = (select top 1 accountid from character where name=(select top 1 g_master from guild where g_name <> @g1 and g_name <> @g2 order by owner_time desc) collate database_default)
DECLARE LISTA CURSOR LOCAL FOR
select name from guildmember where g_name = @g1 order by event_count desc
OPEN LISTA
FETCH NEXT FROM LISTA INTO
@name
WHILE @@FETCH_STATUS = 0
begin
set @num = @num+1
if @num > 0 and @num <6
begin
set
@acc = (select top 1 accountid from character where name =
@name)
update character set exp_war=exp_war+3000 where name=@name
end
if @num > 5
begin
update character set exp_war=exp_war+3000 where name =
@name
end
FETCH NEXT FROM LISTA INTO
@name
end
CLOSE LISTA
DEALLOCATE LISTA
set @num = 0
DECLARE LISTA CURSOR LOCAL FOR
select name from guildmember where g_name = @g2 order by event_count desc
OPEN LISTA
FETCH NEXT FROM LISTA INTO
@name
WHILE @@FETCH_STATUS = 0
begin
set @num = @num+1
if @num > 0 and @num <6
begin
set
@acc = (select top 1 accountid from character where name =
@name)
update character set exp_war=exp_war+2000 where name=@name
end
if @num > 5
begin
update character set exp_war=exp_war+2000 where name =
@name
end
FETCH NEXT FROM LISTA INTO
@name
end
CLOSE LISTA
DEALLOCATE LISTA
set @num = 0
DECLARE LISTA CURSOR LOCAL FOR
select name from guildmember where g_name = @g3 order by event_count desc
OPEN LISTA
FETCH NEXT FROM LISTA INTO
@name
WHILE @@FETCH_STATUS = 0
begin
set @num = @num+1
if @num > 0 and @num <6
begin
set
@acc = (select top 1 accountid from character where name =
@name)
update character set exp_war=exp_war+1000 where name=@name
end
if @num > 5
begin
update character set exp_war=exp_war+1000 where name =
@name
end
FETCH NEXT FROM LISTA INTO
@name
end
CLOSE LISTA
DEALLOCATE LISTA
update CashShopData set wCoinC = wCoinC+20 where AccountID=@gm1
update CashShopData set wCoinC = wCoinC+15 where AccountID=@gm2
update CashShopData set wCoinC = wCoinC+10 where AccountID=@gm3
insert into log_creditos ( login, valor, ip, tipo ) values (@gm1,'20','1','10')
insert into log_creditos ( login, valor, ip, tipo ) values (@gm2,'15','1','10')
insert into log_creditos ( login, valor, ip, tipo ) values (@gm3,'10','1','10')
declare
@dado int
select
@dado = (select top 1 owner_count from guild where g_name=@g1 order by owner_count desc)
Insert into top_semanal ( nome, dado, tipo, rank ) values (@g 1,@dado,'7','1')
select
@dado = (select top 1 owner_count from guild where g_name=@g2 order by owner_count desc)
Insert into top_semanal ( nome, dado, tipo, rank ) values (@g2,@dado,'7','2')
select
@dado = (select top 1 owner_count from guild where g_name=@g3 order by owner_count desc)
Insert into top_semanal ( nome, dado, tipo, rank ) values (@g3,@dado,'7','3')
update guild set owner_time = 0,owner=0,owner_count=0 where owner_time > 0
===============================================================================================
JOB 2 - TOP REI DO MU INDIVIDUAL
===============================================================================================
declare
@nome char(10),
@dado int,
@tipo smallint,
@data smalldatetime
select @nome = (select top 1 name from guildmember order by event_count desc)
select
@dado = (select top 1 event_count from guildmember order by event_count desc)
select @tipo = '9'
Insert into top_semanal ( nome, dado,tipo, rank ) values (@nome,@dado,@tipo,1)
update character set exp_war=exp_war+5000 where name = @nome
update guildmember set event_count = 0 where name = @nome
select @nome = (select top 1 name from guildmember order by event_count desc)
select
@dado = (select top 1 event_count from guildmember order by event_count desc)
select @tipo = '9'
Insert into top_semanal ( nome, dado,tipo, rank ) values (@nome,@dado,@tipo,2)
update character set exp_war=exp_war+4000 where name = @nome
update guildmember set event_count = 0 where name = @nome
select @nome = (select top 1 name from guildmember order by event_count desc)
select
@dado = (select top 1 event_count from guildmember order by event_count desc)
select @tipo = '9'
Insert into top_semanal ( nome, dado,tipo, rank ) values (@nome,@dado,@tipo,3)
update character set exp_war=exp_war+3000 where name = @nome
update guildmember set event_count = 0 where name = @nome
select @nome = (select top 1 name from guildmember order by event_count desc)
select
@dado = (select top 1 event_count from guildmember order by event_count desc)
select @tipo = '9'
Insert into top_semanal ( nome, dado,tipo, rank ) values (@nome,@dado,@tipo,4)
update character set exp_war=exp_war+2000 where name = @nome
update guildmember set event_count = 0 where name = @nome
select @nome = (select top 1 name from guildmember order by event_count desc)
select
@dado = (select top 1 event_count from guildmember order by event_count desc)
select @tipo = '9'
Insert into top_semanal ( nome, dado,tipo, rank ) values (@nome,@dado,@tipo,5)
update character set exp_war=exp_war+1000 where name = @nome
update guildmember set event_count = 0 where event_count>0
===============================================================================================