Delete Invalid Hatching TacticsID using SQL Cursor

Results 1 to 6 of 6
  1. #1
    Don't touch my Nutella! Witchy Moo is offline
    MemberRank
    Aug 2013 Join Date
    SingaporeLocation
    208Posts

    note Delete Invalid Hatching TacticsID using SQL Cursor

    Hi I'd like to share something related to "Hatching TacticsID" error. I think there's a lot of ways posted here, but I figure to post one as alternative, newbie way :)

    Ok let's begin. This is the error, some of you probably got the same:



    If you want to delete any invalid TacticsID from RefNest to clear that error, use this query:
    Code:
    USE [SRO_VT_SHARD]
    GO
    SET NOCOUNT ON;
    DECLARE @invalidTacticsID INT;
    DECLARE RefNest_Cursor CURSOR FOR SELECT DISTINCT dwTacticsID FROM Tab_RefNest AS T WHERE NOT EXISTS (SELECT * FROM Tab_RefTactics AS R WHERE T.dwTacticsID = R.dwTacticsID) ORDER BY dwTacticsID ASC;
    OPEN RefNest_Cursor;
    FETCH NEXT FROM RefNest_Cursor INTO @invalidTacticsID;
    WHILE @@FETCH_STATUS = 0
    BEGIN
        DELETE FROM Tab_RefNest WHERE dwTacticsID = @invalidTacticsID;
        PRINT 'dwTacticsID: ' + CAST(@invalidTacticsID AS VARCHAR) + ' deleted from Tab_RefNest.';
        FETCH NEXT FROM RefNest_Cursor INTO @invalidTacticsID;
    END;
    CLOSE RefNest_Cursor;
    DEALLOCATE RefNest_Cursor;
    GO
    And reload your GameServer to see if the error still appears ;)

    Good luck and have fun, hope this helps a little bit.
    Witchy
    Last edited by Witchy Moo; 14-11-13 at 04:38 AM.


  2. #2
    In the Emperor name Caosfox is offline
    MemberRank
    Jun 2011 Join Date
    Balcora GateLocation
    1,608Posts

    Re: [SHARE] Delete Invalid Hatching TacticsID using SQL Cursor

    nice one

  3. #3
    Don't touch my Nutella! Witchy Moo is offline
    MemberRank
    Aug 2013 Join Date
    SingaporeLocation
    208Posts

    Re: [SHARE] Delete Invalid Hatching TacticsID using SQL Cursor

    Quote Originally Posted by Caosfox View Post
    nice one
    thank you :) :)

  4. #4
    non timebo mala ! Isoline is offline
    MemberRank
    Jan 2013 Join Date
    228Posts

    Re: [SHARE] Delete Invalid Hatching TacticsID using SQL Cursor

    Cursors are really useful :) too bad that they are slow as fuck :(

  5. #5
    Don't touch my Nutella! Witchy Moo is offline
    MemberRank
    Aug 2013 Join Date
    SingaporeLocation
    208Posts

    Re: [SHARE] Delete Invalid Hatching TacticsID using SQL Cursor

    Quote Originally Posted by Isoline View Post
    Cursors are really useful :) too bad that they are slow as fuck :(
    Yep, true. it does help sometimes though, as long as we don't use it for in-game related transact :P

  6. #6
    non timebo mala ! Isoline is offline
    MemberRank
    Jan 2013 Join Date
    228Posts

    Re: [SHARE] Delete Invalid Hatching TacticsID using SQL Cursor

    Quote Originally Posted by witchymoo View Post
    Yep, true. it does help sometimes though, as long as we don't use it for in-game related transact :P
    indeed, even though im pretty sure that db by default is using some cursors in some transactions and procedures



Advertisement