| CREATE PROCEDURE imbacodermyst AS 
 -- amfetamin ve www.frienzko.info için oluşturulmuştur.
 -- 27 Nisan 2008 tarihinde Myst tarafından oluşturulmuştur.
 -- Script üzerinde değişiklik yapan Toptur , Delikli Nane POLO dur , Ajdardır
 -- Tüm hakları saklı değil , açıkta ve ortadadır
 
 truncate table np_kings
 insert  np_kings
 select top 100 strUserID, Loyalty,  LoyaltyMonthly, 'gokhantasci'
 from USERDATA
 where Nation = 1
 order by Loyalty desc, LoyaltyMonthly desc
 
 truncate table np_kings2
 insert  np_kings2
 select top 100 strUserID, Loyalty,  LoyaltyMonthly, 'gokhantasci'
 from USERDATA
 where Nation = 2
 order by Loyalty desc, LoyaltyMonthly desc
 
 
 declare @KarusD varchar(21), @KarusH varchar(21), @KarusM varchar(21),  @KarusS varchar(21), @KarusMi varchar(21), @KarusT varchar(21), @ElmoD varchar(21), @ElmoH varchar(21), @ElmoM varchar(21),  @ElmoS varchar(21), @ElmoMi varchar(21), @ElmoT varchar(21)
 select  @KarusD = struserid from np_kings where nrank = 1
 select  @KarusH = struserid from np_kings where nrank = 2
 select  @KarusM = struserid from np_kings where nrank = 3
 select  @KarusS = struserid from np_kings where nrank = 4
 select  @KarusMi = struserid from np_kings where nrank = 5
 select  @KarusT = struserid from np_kings where nrank = 6
 select  @ElmoD = struserid from np_kings2 where nrank = 1
 select  @ElmoH = struserid from np_kings2 where nrank = 2
 select  @ElmoM = struserid from np_kings2 where nrank = 3
 select  @ElmoS = struserid from np_kings2 where nrank = 4
 select  @ElmoMi = struserid from np_kings2 where nrank = 5
 select  @ElmoT = struserid from np_kings2 where nrank = 6
 
 /* Update part wowowo */
 update user_knights_rank set strelmouserid = @ElmoD, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @elmoD)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoD), strkarususerid = @karusD, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @karusD)), nkarusLoyalty = (select loyalty from userdata where struserid = @karusD) where shindex = 1
 update user_knights_rank set strelmouserid = @ElmoH, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @ElmoH)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoH), strkarususerid = @KarusH, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @KarusH)), nkarusLoyalty = (select loyalty from userdata where struserid = @KarusH) where shindex = 2
 update user_knights_rank set strelmouserid = @ElmoM, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @ElmoM)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoM), strkarususerid = @KarusM, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @KarusM)), nkarusLoyalty = (select loyalty from userdata where struserid = @KarusM) where shindex = 3
 update user_knights_rank set strelmouserid = @ElmoS, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @ElmoS)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoS), strkarususerid = @KarusS, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @KarusS)), nkarusLoyalty = (select loyalty from userdata where struserid = @KarusS) where shindex = 4
 update user_knights_rank set strelmouserid = @ElmoMi, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @ElmoMi)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoMi), strkarususerid = @KarusMi, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @KarusMi)), nkarusLoyalty = (select loyalty from userdata where struserid = @KarusMi) where shindex = 5
 update user_knights_rank set strelmouserid = @ElmoT, strelmoknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @ElmoT)), nElmoLoyalty = (select loyalty from userdata where struserid = @ElmoT), strkarususerid = @KarusT, strkarusknightsname = (select idname from knights where idnum = (select knights from userdata where struserid = @KarusT)), nkarusLoyalty = (select loyalty from userdata where struserid = @KarusT) where shindex = 6
 /* end of the update */
 
 GO
 |