Paylasalim.forumdizini.com (P.F)

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    En SOn 3 AY Önce charına girenleri Db den Sİlme Kodu

    hako90
    hako90
    Profesyonel Üye

    Profesyonel Üye


    En SOn 3 AY Önce charına girenleri Db den Sİlme Kodu Besikt10copy
    Mesaj Sayısı : 396
    Kayıt tarihi : 10/12/09
    Forum Başarısı : 12495
    Rep Puanı : 2
    Cinsiyeti : En SOn 3 AY Önce charına girenleri Db den Sİlme Kodu I_icon_gender_male Doğum tarihi : 29/12/93
    Yaş : 30
    Hangi Şehir : Ankara
    Hangi Ülke : Türkiye
    Lakap : Yoktur

    En SOn 3 AY Önce charına girenleri Db den Sİlme Kodu Empty En SOn 3 AY Önce charına girenleri Db den Sİlme Kodu

    Mesaj tarafından hako90 Ptsi Ara. 14, 2009 12:33 pm

    1. uygulayacağımız kod
    Kod:
    delete userdata where updatetime < '2009-10-10 01:03:00' and loyalty < 10000
    np si 10k dan az, 2009 yılının 10. ayının 10.günü saat 01:03 den önce giriş yapmış ve bir daha oyuna girmemiş charlari silmek için kullanılan kod dur.
    Tarihi isteğinize göre değiştirebilirsiniz. Yıl/ay/gün şeklinde.

    Bir kod daha var ( userdatadan silinen charlari account_chardan da siliyor ). Önce yukarda verdiğim Kodu çalıştırınız, ardından aşağıdaki kodu calistiriniz.
    2.uygulayacağımız kod.
    Kod:
    CREATE PROCEDURE [temizlik1]
    --@AccountID    varchar(21)
    AS
    SET NOCOUNT ON
    DECLARE @AccountID varchar(21)
    DECLARE @m1 char(21), @m2 char(21), @m3 char(21), @s1 tinyint, @s2 tinyint, @s3 tinyint, @c1 char(21), @c2 char(21), @c3 char(21), @r1 tinyint, @r2 tinyint, @r3 tinyint,@u char(21)
    SET @r1=0
    SET @r2=0
    SET @r3=0
    SET @s1=0
    SET @s2=0
    SET @s3=0
    SET @c1=null
    SET @c2=null
    SET @c3=null
    DECLARE job1 CURSOR FOR
    Select straccountid from Account_char
    OPEN job1
    FETCH NEXT FROM job1
    INTO @AccountID
    WHILE @@fetch_status = 0
    BEGIN
    SELECT @c1 = strcharid1, @c2 = strcharid2, @c3 = strcharid3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
    SELECT @r1=count(struserid) FROM [dbo].[USERDATA] WHERE strUserId=@c1
    IF @r1=0
    UPDATE ACCOUNT_CHAR set strcharid1=null where strAccountID = @AccountID
    SELECT @r2=count(struserid) FROM [dbo].[USERDATA] WHERE strUserId=@c2
    IF @r2=0
    UPDATE ACCOUNT_CHAR set strcharid2=null where strAccountID = @AccountID
    SELECT @r3=count(struserid) FROM [dbo].[USERDATA] WHERE strUserId=@c3
    IF @r3=0
    UPDATE ACCOUNT_CHAR set strcharid3=null where strAccountID = @AccountID
    SELECT @m1 = strcharid1, @m2 = strcharid2, @m3 = strcharid3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
    select @s1=count(struserid) from [dbo].[USERDATA] where strUserId=@m1
    select @s2=count(struserid) from [dbo].[USERDATA] where strUserId=@m2
    select @s3=count(struserid) from [dbo].[USERDATA] where strUserId=@m3
    update account_char set bcharnum=@s1+@s2+@s3 where strAccountID=@AccountID
        FETCH NEXT FROM job1
        INTO @AccountID
    END
    CLOSE job1
    DEALLOCATE job1
    SET NOCOUNT OFF
    GO

    3.uygulayacağımız kod

    Kod:
    delete account_char where strcharid1 is null and strcharid2 is null and strcharid3 is null
    delete tb_user where straccountid not in (select straccountid from account_char)
    delete warehouse where straccountid not in (select straccountid from tb_user)
    3 hesaptan 1 i aktif ise kullanılıyorsa bu işlemi gerçekleştiremezsiniz.

      Forum Saati Ptsi Mayıs 06, 2024 6:25 pm