can any one help me for time sql

03/25/2015 05:41 where_love2003#1
Morning all Elitepvp
i want some help
first i have this table
[Only registered and activated users can see links. Click Here To Register...]
i want every 1 week select top total like this
(SELECT TOP 10 * FROM SRO_VT_ACCOUNT.dbo._UniqueRank order by total desc)
and give 1 top academy ranking 1
and truncate SRO_VT_ACCOUNT.dbo._UniqueRank this Table
i hope any one help me for that
03/25/2015 09:07 Aaron*#2
Do it manually every week xD
Quote:
declare @shiz int = (select max(total) from account.._uniquerank)
declare @lawl varchar(max) = (select top 1 charname16 from account.._uniquerank where total = @shiz)
declare @lel int = (select charid from _char where charname16 like @lawl)
declare @jjaja int = (Select TOP 1 CampID FROM _TrainingCampBuffStatus Where RecipientCharID = @lel)
UPDATE [Dbo].[_TrainingCamp]
SET GraduateCount = 87729
WHERE [Dbo].[_TrainingCamp].[ID] = @jjaja
UPDATE [dbo].[_TrainingCampMember]
SET HonorPoint = 559970
WHERE [dbo].[_TrainingCampMember].[CampID]=@jjaja
03/25/2015 22:20 where_love2003#3
but what can i do if char not in academy ?

any help pleas
03/26/2015 05:26 ersers2#4
Quote:
Originally Posted by where_love2003 View Post
but what can i do if char not in academy ?

any help pleas
I think there is a stored procedure to create a training camp. So you could check a table which is a list of all the training camps on the server, see if the character's name is listed

pseduo-sql: declare @MyCounter int;
SELECT @MyCounter = COUNT(*)
FROM (SELECT CharName16 FROM ListofTrainingCampsTable where CharName16 LIKE @CharNameOfAcademyLeader)
IF @MyCounter =0 then exec _create_a_training_camp(@CharNameOfAcademyLeader)

update***
I got asked a question: "but what about @CharNameOfAcademyLeader ? "
answer:
i think this variable will be filled with a real character name as a result of the query to find the best unique killer on the server:
@CharNameOfAcademyLeader --> pseduo-sql: Select top 1 player of unique kills
03/26/2015 06:22 where_love2003#5
Quote:
Originally Posted by ersers2 View Post
I think there is a stored procedure to create a training camp. So you could check a table which is a list of all the training camps on the server, see if the character's name is listed

pseduo-sql: declare @MyCounter int;
SELECT @MyCounter = COUNT(*)
FROM (SELECT CharName16 FROM ListofTrainingCampsTable where CharName16 LIKE @ CharNameOfAcademyLeader)
IF @MyCounter =0 then exec _create_a_training_camp(@CharNameOfAcademyLeader)
thanks sir to try help me